combining IF OR Functions

K

kevan

I am trying to combine the following if functions with an or funtion which
will provide mw with the answer 6,10,14,21 or 25.
=IF($AG$2="3-6","6", "Not OK")
=IF($AG$3="7-10","10", "Not OK")
=IF($AG$4="11-14","14", "Not OK")
=IF($AG$5="18-21","21", "Not OK")
=IF($AG$6="22-25","25", "Not OK")

My attempts so far are futile. Can anyone help?

Thanks
 
S

ShaneDevenshire

Hi,

There may be a logic error here, if AG2 does not contain 3-6 the formula
returns "Not OK". Once that is done the function would not go on to check
AG3. If it did it would return something like Not OK, Not OK, Not OK, 21,
Not OK. Would you really want all those answers. Here is probably what you
want:

=IF($AG$2="3-6",6,IF($AG$3="7-10",10,IF($AG$4="11-14",14,IF($AG$5="18-21",21,IF($AG$6="22-25",25, "Not OK")))))

You don't need to quote numbers so I took those quotes out.
 
K

kevan

Thanks Shane it worked perfectly once I had corrected my own error about cell
numbers....

=IF($AG2="3-6",6,IF($AG2="7-10",10,IF($AG2="11-14",14,IF($AG2="18-21",21,IF($AG2="22-25",25, "Not OK")))))

Thanks again
 

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