View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default IF Function (Possibly) to Apply a Value Depending on Value

"Toria" wrote:
In column D, I have units. I have to apply values to the number of units.
If
the number is between 0-50 units, I apply 0, if between 51-200, I would
need
to apply .05, if between 201-500, i would need to apply .10 and so on.
The
numbers go above 10,000. Is this possible? I'm terrible at nested IFs. I
tried and kept getting errors and didn't see any similar questions.


I don't know that "apply" means: add to something (what?), multiply,
divide, etc?

I will ignore that and simply demonstrate how to return the "applied" factor
(0, 0.05, 0.10, etc).

Also, I see no numerical progression of tiers, 0-50, 51-200, 201-500 etc. I
don't know what the next tiers would be, other than the next one starts with
501. Moreover, it is unclear what the next "applied" factor would be: 0.15
(adding 0.05 for each tier), or 0.20 (doubling for each tier), or something
else altogether.

Consequently, I would eschew any algebraic formulation of this. Instead, I
would suggest a lookup table in one form or another. That is the most
flexible method, albeit not always the most efficient. It is certainly
better than using nested IFs, especially for anything more than 8 tiers.

If the number of tiers is small (managable), you might consider a LOOKUP()
expression of the form LOOKUP(D1,{0,51,201,...},{0,0.05,0.10,...}), where
you fill in the "..." with the remaining numbers.

But if the number of tiers is large, you might consider a lookup table in an
out-of-the-way range of cells in the workbook. For example, if X1:X20
contains the tier lower bounds 0, 51, 201 etc, and Y1:Y20 contains the
corresponding "applied" factors 0, 0.05, 0.10 etc., you could use a LOOKUP()
expression of the form LOOKUP(D1,X1:Y20).

Hope that helps. If not, I suspect you need to provide more specifics.

For example, what are __all__ the tiers breakpoints (0, 51, 201 etc), and
what are __all__ the "applied" factors (0, 0.05, 0.10 etc); or what are the
rules for determining those breakpoints and corresponding factors? And are
the number of units in column D always integral values (whole numbers)?

Also, what does "apply" mean? What do you "apply" it to, and how? Provide
some numeric examples to demonstrate your expectations.