# Multi IF, Multi OR & Multi AND

1. ## Multi IF, Multi OR & Multi AND

Hi,

How can I write this formula:

IF(A1=1 and A2=2) then VLOOKUP(C1....) OR IF(B1=3 and B2=4) then VLOOKUP(D1....)

OR................ otherwise F1  Register To Reply

2. ## Re: Multi IF, Multi OR & Multi AND

Something like..

=IF(AND(A1=1,A2=2),VLOOKUP(C1,....),IF(AND(B1=3,B2=4,VLOOKUP(D1,.....),.......,F1)

But you don't want to many nested IF's, especially in pre 2007.

If you detail your problem, someone may be able to help create a more efficient formula.  Register To Reply

3. ## Re: Multi IF, Multi OR & Multi AND

Just a minor correction to NBVC's formula: ``Please Login or Register  to view this content.``
Cheers,  Register To Reply

4. ## Re: Multi IF, Multi OR & Multi AND

Hi,

Thanks for the help, well... I really need to use multiple IFs and ORs in XL 2003, below is my formula; can we shorten it somehow to be able to use more IFs:  Register To Reply

5. ## Re: Multi IF, Multi OR & Multi AND

Hi,
Is it possible to share a version of the spreadsheet you are using so we can visually see what you are trying to accomplish? I am not sure if you can shorten it down due to the lookup value changing based on each logical test. Also I found when searching that someone may have an answer already to your puzzle with the nested IF's, searched while I was replying here.
http://www.excelforum.com/excel-gene...e-formula.html

Basically he is suggesting using some clever calculations outside the nesting, but I am not sure that would help your situation. ``Please Login or Register  to view this content.``  Register To Reply

6. ## Re: Multi IF, Multi OR & Multi AND Originally Posted by Ralem Hi,

Thanks for the help, well... I really need to use multiple IFs and ORs in XL 2003, below is my formula; can we shorten it somehow to be able to use more IFs:

This formula doesn't really make a great deal of sense to me.

It basically seems to read that if "g" can be found in any of H5, H9, H13, H17, or H21 and AK5 can be found in AB2:AG2 then to conduct a VLOOKUP based on AK5.

However given the use of references etc the implication is simply that you wish to return the contents from Column AM - ie if AK5 is found in the header row then return the value in Col AM (given the VLOOKUP of AK5 will simply be the first row)

Based on the above, perhaps then: ``Please Login or Register  to view this content.``
if the "g" test is repeated on each row then I would suggest calculating just once and referring to the result cell thereafter (ie avoid repetitive calcs.)  Register To Reply

7. ## Re: Multi IF, Multi OR & Multi AND

Thanks guys,

but, DonkeyOte, It'snot like: IF any of OR, each IF(AND is one different case...  Register To Reply

8. ## Re: Multi IF, Multi OR & Multi AND

The formula provided apes the formula you posted so I'm not really sure as to your point.

Your current formula makes little sense from a syntax perspective given each VLOOKUP is identical albeit for the criteria which is itself simply the value in AK assuming it is found in row 2.

I would suggest you post a sample file to better illustrate your question / requirements.  Register To Reply

9. ## Re: Multi IF, Multi OR & Multi AND  Register To Reply

10. ## Re: Multi IF, Multi OR & Multi AND

I agree with DonkeyOte, as to your formula not making too much sense.

You have the same code repeated in column L several times... I assume you just want to match the code on the same row?

To me, this formula: =IF(G5="g",N5,NA()) seems to be what you might want... I am not sure why the Vlookup is even necessary If says that if G5 is "g", then just return what is in column N within the same row.. (i.e. the 3rd column from column L.  Register To Reply

11. ## Re: Multi IF, Multi OR & Multi AND

Hi,

Please find the attachment, it's the same with some corrections....

Have you clicked F5 and L5, this is designed to auto calculate Slope by entering numbers 1,2,....or 5 over column D, try to delete and add some of these numbers and notice the calculated slope....
did you notice that I6 and I7 are N/A coze there is no g in cell G13;

Slope in cell F5 is calculated from 1 numbers typed in column D... g in cell G5 is related to slope1 data and will show in column I,J and K the data only opposite those ones.... hope this clarify it..
Actually this is just a part of my spreadsheet, the idea is to apply conditional format on data series on a chart and have to do this coze I'm using excel 2003.  Register To Reply

12. ## Re: Multi IF, Multi OR & Multi AND

Maybe in I5, then: ``Please Login or Register  to view this content.``
copied down.

You can have up to 30 AND() conditions in there (in Excel2003).

use same in other columns.. but adjust the N5 to get your desired number from M:O  Register To Reply

13. ## Re: Multi IF, Multi OR & Multi AND

Very nice NBVC, thanks a lot this will solve for me the limitation of IFs in XL 2003  Register To Reply

14. ## Re: Multi IF, Multi OR & Multi AND Originally Posted by Ralem this will solve for me the limitation of IFs in XL 2003
Not sure if that is a question or not, but yes, it will solve that limitation as you can use up to 30 AND() conditiions within the OR() functions  Register To Reply