# Nesting Limit Hit Using IF and AND functions

#### HomeTek

##### New Member
Hi all,

Using Excel 2007

I have Googled and Googled and tried to use various examples to help me with this but to no avail.

I know nesting isn't ideal, but I need to possibly nest around 10 statements. However I have hit the limit of 7 and can no longer add any more conditions.

Below is an example of the formula I have been using.

=IF(AND(B16="Yes",B19="No",B22="No",B25="Yes"),"Result 1",IF(AND(B16="Yes",B19="No",B22="No",B25="No"),"Result 2",IF(AND(B16="Yes",B19="No",B22="",B25="Yes"),"Result 3",IF(AND(B16="Yes",B19="No",B22="",B25="No"),"Result 4",IF(AND(B16="Yes",B19="No",B22="Yes",B25="No"),"Result 5",IF(AND(B16="Yes",B19="Yes",B22="No",B25="Yes"),"Result 6",IF(AND(B16="Yes",B19="Yes",B22="No",B25="No"),"Result 7","")))))))

If I was using a later Excel I would have no problems as the limit is higher and I only need around 10 or so nesting levels. But unfortunately I am using Excel 2007 and have hit the limit.

Does anyone know how I could amend the formula above at all to get around this problem or maybe I need to totally scrap it and look at it from a different angle?

Many thanks

#### steve the fish

##### Well-known Member
A lookup table in A1:B10?

 Yes|No|No|Yes Result 1 Yes|No|No|No Result 2 Yes|No||Yes Result 3 Yes|No||No Result 4 Yes|No|Yes|No Result 5 Yes|Yes|No|Yes Result 6 Yes|Yes|No|No Result 7

<colgroup><col><col></colgroup><tbody>
</tbody>

Then a vlookup:

=IFERROR(VLOOKUP(B16&"|"&B19&"|"&B22&"|"&B25,\$A\$1:\$B\$10,2,0),"")

#### HomeTek

##### New Member
Brilliant. It works perfectly.

I did try to use a Vlookup originally, but I had no idea you could do a Vlookup using multiple cells like that until now.

Much appreciated.

1,082,295
Messages
5,364,359
Members
400,792
Latest member
Dxmiian

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...