NESTED IF's too many

S

saturnin02

Hi,
I need to calculate If staments based on the formula below.
Unfortunately, there are too many nested IF statements.

How can I write this formula in a more intellignet way that will work?


=IF(B15=1,A15,IF(B15=2,A16,IF(B15=3,A17,IF(B15=4,A18,IF(B15=5,A19,IF(B15=6,A
20,IF(B15=7,A21,if(B15=8,A22,IF(B15=9,A23,IF(B15=10,A24,IF(b15=11,A25,IF(B15
=12,A23,IF(B15=13,A26,IF(B15=14,A27)))))))

Tx,

Sat
 
A

Aladin Akyurek

It looks like...

=INDEX($A$15:$A$27,B15)

saturnin02 said:
Hi,
I need to calculate If staments based on the formula below.
Unfortunately, there are too many nested IF statements.

How can I write this formula in a more intellignet way that will work?


=IF(B15=1,A15,IF(B15=2,A16,IF(B15=3,A17,IF(B15=4,A18,IF(B15=5,A19,IF(B15=6,A
20,IF(B15=7,A21,if(B15=8,A22,IF(B15=9,A23,IF(B15=10,A24,IF(b15=11,A25,IF(B15
=12,A23,IF(B15=13,A26,IF(B15=14,A27)))))))

Tx,

Sat
 
S

saturnin02

I went with the index one as simpler.
But I do appreciate your suggestion which will come in handy sometime soon
for me.
Best,
Sat
 
K

Ken Wright

Hi Aladin, I'm probably being dense here I know, but I can't get the last few values to work with
that - 12/13/14 to return A23/A26/A27. Is the Ops sequence wrong, or what am I missing here?
 
T

Tim Otero

This does not do what you originally intended. Per your post, as Dan pointed
out, when B15 = 12 the result should be A23 not A26 , as this solution
results(B15=13 and B15=14 are also different). If you really want the result
to equal A23 when B15=12, then I suggest you use Dan's second solution.

tim
 
A

Aladin Akyurek

Ken,

I hope the OP's posted seq is wrong. I just jumped to the conclusion while
reading that there was an orderly seq. & that's the reason why I prefixed my
answer with "It looks like...".

Aladin
 
S

saturnin02

Index just works perfectly for my purpose.
Tx to everybody that contributes btw.
Sat
 
K

Ken Wright

Just threw me a tad when he said it worked, but then didn't qualify the post wrt to the comments
made by the others about the sequence not being as sequential as everyone first thought. Think
you were probably correct in your guess though. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top