473,762 Members | 8,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question For Microsoft Access Data Base

20 New Member
Question For Microsoft Access Data Base
--------------------------------------------------------------------------------

I am Trying to create a single formula that would do the following:

If A1 is less then or equal to 499, deliver B1*1, if A1 is equal to or less than 999 but more than and including 500, deliver B1*2, If A1 is equal to or less than 1499 but more than and including 1000, deliver B1*3, AND SO ON.....

I have read the Posts on this and they don't Work

=Int(A1/500)*B1 Dont work, It gives the wrong values for 500, 1000, 1500, etc

+Int(A1/500+1)-(MOD(A1,500)=0 Dont work, I cant get Access to except this formula. It wont save. It changes back to whatever was in the Control Source.

I am not an expert at this and the third response from what I can tell looks like an answer for Excel and not Access, Well I cant figure it out. Creating the Table which is the first part makes no since on how to do it.

That post was as follows:
[This followup was posted to microsoft.publi c.excel.workshe et.functions
with an email copy to =?Utf-8?B?QW1hbg==?=.
Please use the newsgroup for further discussion.]

Three possibilities, in addition to the option already discussed by
others, are below. None of the options requires the thresholds to be
equally spaced, nor that the return values be 1,2,3, etc.

1) Use the formula =B1*(IF(A1<=0,0 ,IF(A1<=500,1,I F(A1<=1000,2,3) )))
This might be the easiest to understand but it has two limitations.
First, IF statements can be nested only 7 deep. There are ways around
the limitation, but they just complicate the matter further. Second,
the thresholds and the returned values are hidden in the formula and
not immediately obvious from looking at the worksheet.

2) Create a table such as:
F G
2 0 1
3 500 2
4 1000 3

And, use the formula
Expand|Select|Wrap|Line Numbers
  1. =B1*INDEX(G2:G4,MATCH(A1,F2:F4,1)-(A1=INDEX(F2:F4,MATCH(A1,F2:F4,1))))
The 2nd part -- following the -( part -- is an adjustment for the fact
that you want the conditions to be 'less than or equal to'. The
advantage of this formula is that it is easy to adjust for more
conditions. The downside is that it might be somewhat intimidating to
a novice.

3) Use the VBA user defined function (UDF) given below as
=TieredPricing( F2:G4,A1,TRUE). The advantage is that it makes the
worksheet more 'self documented' and it further separates the code from
the data. The downside is the need for a VBA module and having to deal
with the accompanying 'This file contains macros' warning.
Expand|Select|Wrap|Line Numbers
  1. Function TieredPricing(LookupTable As Range, LookupValue As Double, _
  2. Optional IncludeBoundaryValue As Boolean = False)
  3. Dim Rslt As Variant
  4. On Error Resume Next
  5. Rslt = Application.WorksheetFunction.Match( _
  6. LookupValue, LookupTable.Columns(1), 1)
  7. If Not IsEmpty(Rslt) Then
  8. If IncludeBoundaryValue _
  9. And LookupTable.Cells(Rslt, 1).Value = LookupValue Then
  10. If Rslt = 1 Then _
  11. TieredPricing = _
  12. "Look up value outside of table values" _
  13. Else _
  14. TieredPricing _
  15. = LookupTable.Cells(Rslt - 1, 2).Value
  16. Else
  17. TieredPricing = _
  18. LookupTable.Cells(Rslt, 2).Value
  19. End If
  20. Else
  21. TieredPricing = "Look up value outside of table values"
  22. End If
  23. End Function
  24.  
None of this is working Please HELP

Joel
Jan 3 '10
24 2959
joeldault
20 New Member
Is there a way to stop getting this from stop returning the value of 11.00 when 0 is entered
Expand|Select|Wrap|Line Numbers
  1. If "" & Me!Number_of_Pages_in_Doc_1 < 0 > "" Then
  2. Me!Total_Costs_1 = Me!Number_of_Pages_in_Doc_1 * 3 + 11 
Jan 5 '10 #21
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hi Joe

Don't forget to put a forward slash (/) before the word code on the closing code tag.

In answer to your questions, try this out ...
Expand|Select|Wrap|Line Numbers
  1.     If Me!Number_of_Pages_in_Doc_1 <> 0 _
  2.         Or NZ(Me!Number_of_Pages_in_Doc_1,"") <> "" Then
  3.  
  4.         Me!Total_Costs_1 = Me!Number_of_Pages_in_Doc_1 * 3 + 11 
  5.     Else
  6.         Me!Total_Costs_1=0
  7.     End If
  8.  
Jan 5 '10 #22
joeldault
20 New Member
Thanks to all of you, I have been having a heck of a time on these problems, You guys have made the problem seam easy, That worked.
Jan 5 '10 #23
MMcCarthy
14,534 Recognized Expert Moderator MVP
Nico and I have a few years doing this between us. You pick up a few things along the way :D One day you'll be the guru helping others.
Jan 5 '10 #24
joeldault
20 New Member
thanks for everything guys
Jan 5 '10 #25

Sign in to post your reply or Sign up for a free account.

Similar topics

17
6644
by: Medi Montaseri | last post by:
Hi, Given a collection of similar but not exact entities (or products) Toyota, Ford, Buick, etc; I am contemplating using the Abstraction pattern to provide a common interface to these products. So I shall have an Abstract Base called 'Car' implemented by Toyota, Ford, and Buick. Further I'd like to enable to client to say Car *factory;
18
7344
by: Andre Laplume via AccessMonster.com | last post by:
I have inherited a bunch of dbs which are are shared among a small group in my dept. We typically use the dbs to write queries to extract data, usually dumping it into Excel. Most dbs originated in MsAccess 97 or prior and have been converted to 2003. On occassion user 1 will open a db. When user 2 opens the db it will not let user 2 modify macros and what not. I can understand this and realize we could split the db; it is not worth ...
5
1465
by: Vai2000 | last post by:
Hi All, I am running into a concurrency problem. I have a worker process which reads some data out of a file and inserts fresh data into it. I have put a Monitor.Enter(this) and Monitor.Exit(this) on both of the routines which do read and writes. The worker process is spawned off by a Multithreaded application. I am seeing error in log which tells me that Description: Stack Trace- at System.IO.__Error.WinIOError(Int32 errorCode, String...
6
1770
by: Peter Oliphant | last post by:
I just discovered that the ImageList class can't be inherited. Why? What could go wrong? I can invision a case where someone would like to add, say, an ID field to an ImageList, possible so that the individual elements in an array of ImageList's could be identified by the ID, thereby allowing re-ordering the array without harm. A person could identify by index into the array, but that would not be preserved by re-ordering (and re-ordering...
8
3385
by: Ben R. | last post by:
Hi all, This is a multipart question. I’ve got an asp.net site that contains an access database. Previously, I would debug by making changes and uploading to my host. Now, I’d like to be able to debug locally and then deploy. I’d really like to use a relative path for the database file (so I could make no changes between hostide and debugging client side. When I try to use a relative path, it doesn’t seem to be referring to...
2
2389
by: Crimson* | last post by:
I've got a table with an entry type as "OLE Object" in Access 2003. In the form that the table is linked to I want to insert an image (BMP) for each record. However, when I attempt to do so the file is inserted and the filename (image.bmp) is inserted in the box with it taking up about half of the box. I didn't have this problem in Access XP. I've tried embedding and linking the file, but this always happens. Can anyone offer any...
7
4473
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears to be checking that the correct data type is used DataAcess sets an abstract class and methods
9
1503
by: Mike Hofer | last post by:
In a large application I'm working on (ASP.NET 1.1, VS2003), we have a base class that wraps stored procedures. Essentially, this base class (StoredProcedureBase) encapsulates the code to set up the connection, transaction, command and parameters required to invoke a stored procedure on our SQL Server database. It provides helper methods that simplify the process of invoking the stored procedure so that our data access classes can make the...
8
1625
by: =?ISO-8859-1?Q?Konrad_M=FChler?= | last post by:
Hi, I've a list of objects. I iterate the list and read the value of each object for many operation like: x = myList.value1 + myList.value2 etc. My question: Is it efficient to always use myList or should I get the pointer to
0
10137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9927
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3914
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.