Nested If with 2 Index Matches

ClaireLou

New Member
Joined
Nov 14, 2020
Messages
10
Office Version
  1. 365
Platform
  1. Windows
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
Joined
Oct 24, 2012
Messages
4,663
Office Version
  1. 365
Platform
  1. MacOS
=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
 
Solution

etaf

Well-known Member
Joined
Oct 24, 2012
Messages
4,663
Office Version
  1. 365
Platform
  1. MacOS
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
Joined
Nov 14, 2020
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Thanks so much for that, I haven't really used nested IF's much before :)
 

Watch MrExcel Video

Forum statistics

Threads
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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top