Nested IF not reading the nested IF's

NICKRENN

New Member
Joined
Sep 6, 2017
Messages
22
Hi All

I've tried to find a solution to this but i just can't see it. using a really basic nested IF

=IF(D4=1,600000,IF(D4=2,525000,IF(D4=3,375000,IF(D4=4,225000,IF(D4=5,100000,IF(D4=6,25000,0))))))

I am only getting a return of 25000 or 0. I have this replicated in D4 to D7 with the scores as follows

[TABLE="width: 250"]
<colgroup><col span="2"></colgroup><tbody>[TR]
[TD]6[/TD]
[TD]25,000[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]#DIV/0![/TD]
[TD]#DIV/0!
[/TD]
[/TR]
</tbody>[/TABLE]

i don't follow why its not reading the 4 or 5?

Any ideas?

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi,

Maybe D4 is not a number , check with value(D4) or =ISNUMBER(D4), what you get ?

and you can try this =CHOOSE(D4,600000,525000,375000,225000,100000,25000)
 
Last edited:
Upvote 0
text number,, if you looked at the cell with =ISNUMBER(D4) it should return true
 
Upvote 0
As previously mentioned a number formatted as text can be the issue.

Can be easily sorted by using CHOOSE instead of a set of nested IF.

Take a look at this:

Book1
ABCD
462500025000
55100000100000
640225000
7900
Sheet2
Cell Formulas
RangeFormula
B4=IF(A4=1,600000,IF(A4=2,525000,IF(A4=3,375000,IF(A4=4,225000,IF(A4=5,100000,IF(A4=6,25000,0))))))
D4=IFERROR(CHOOSE(A4,600000,525000,375000,225000,100000,25000,),0)
 
Last edited:
Upvote 0
you might even force D4 to a number with a double minus sign

=IF(--D4=1,600000,IF(--D4=2,525000,

the other thing is if you left a space around the number in which case TRIM is required
 
Last edited:
Upvote 0
the other thing is if you left a space around the number in which case TRIM is required

So right, that's exactly why i suggested to use CHOOSE because function will actually force the field to a number if it looks like a number.
Check this:

Book1
ABCD
462500025000
550100000
6030375000
7900
Sheet2
Cell Formulas
RangeFormula
A6=TEXT(3,"00")
B6=IF(A6=1,600000,IF(A6=2,525000,IF(A6=3,375000,IF(A6=4,225000,IF(A6=5,100000,IF(A6=6,25000,0))))))
D6=IFERROR(CHOOSE(A6,600000,525000,375000,225000,100000,25000,),0)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top