View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre Ron Coderre is offline
external usenet poster
 
Posts: 2,118
Default IF statement with a range

Here's an option that won't be limited to the 7-nesting level limitation.

Put this table in A1:B6
0 0-500
501 501-1000
1001 1001-5000
5001 5001-10000
10001 10001-25000
25001 25000

With a value in D2

This formula returns the category for the value in D2
E2: =VLOOKUP(D2,A1:B6,2,1)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"ricky" wrote:

Thanks guys for the solutions. Worked just fine.

I took it a step further by writing nested IF statements on the FALSE
portion, to cater for differing values of D2.

This is what I came up with :

=IF(AND(D2=0,D2<=500),"0-500",IF(AND(D2=501,D2<=1000),"501-1000",IF(AND(D2
=1001,D2<=5000),"1001-5000",IF(AND(D2=5001,D2<=10000),"5001-10000",IF(AND(

D2=10001,D2<=25000),"10001-25000",IF((D2=25001),"25001","0"))))))

Kind Regards

Ricky


"Ron Coderre" wrote in message
...
Try this:

=IF(AND(D20,D2<5000000), "5m","0m")

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"ricky" wrote:

Hi

Is there anyway I can write the following:

IF(D20 and <5000000, "5m","0m")

To populate another cell for reporting purposes.

Kind Regards

Ricky