# Nested If with 2 Index Matches

#### ClaireLou

##### New Member
Hi

I'm trying to pull back a reference number and a date. They could be on one of 2 sheets. I originally used 2 Index Matches but used the &" "& to separate them and it wasn't working with the date, I couldn't get it into the date format. Someone suggested putting it into a nested IF formula. I've put one of the index matches below that I need it to do but I'm not sure how to put that into a nested IF. The date is similar but with different columns.

IFERROR(INDEX(MKZ!D:D,MATCH('Sheet1'!H6,MKZ!N:N,0))
IFERROR(INDEX(SGC!D:D,MATCH('Sheet1'!H6,SGC!N:N,0))

I'd really appreciate any help

Thanks

### Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

#### etaf

##### Well-known Member
=IFERROR(INDEX(MKZ!D:D,MATCH(Sheet1!H6,MKZ!N:N,0)),IFERROR(INDEX(SGC!D:D,MATCH(Sheet1!H6,SGC!N:N,0)),"NoMatch"))

This will test the first sheet MKZ FIRST and if no match found will then try the SGC sheet , if no match then returns nomatch

If you want to Test SGC sheet first , then change so that formula is the first

#### ClaireLou

##### New Member
You are a star!!!! Thanks so much

#### etaf

##### Well-known Member
you are welcome

its not really a nested IF in the true sense
IF( TEST, TRUE , FALSE)
is a normal IF you can add another IF in place of the TRUE or FALSE or both - to make a nested IF
IF( TEST1, TRUE , IF( TEST2, TRUE , FALSE))
So if TEST1 is FALSE - then it will do the 2nd IF and so do a test2

#### ClaireLou

##### New Member
Thanks so much for that, I haven't really used nested IF's much before

Replies
3
Views
126
Replies
6
Views
96
Replies
3
Views
311
Replies
4
Views
41
Replies
3
Views
179

1,129,592
Messages
5,637,290
Members
416,962
Latest member
samfuge

### 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.

### Which adblocker are you using?

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

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