Different formulas in one cell.

itsgrady

Board Regular
Joined
Sep 11, 2022
Messages
115
Office Version
  1. 2021
Platform
  1. Windows
  2. MacOS
Should be simple but I am having a difficult time putting two lookups in one cell to work in finding the information. If the first range does not have the information then the second range should have it. I will also need to add another range at a later date. Below are the two formulas I would like to add together in one cell:

IF(C25=“”,””,VLOOKUP(C25,’Sheet1’!$A:$G,2,False))

Or

IF(C25=“”,””,VLOOKUP(C25,’Sheet2’!$C:$D,2,False))

Thanks for the help.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
try using IFERROR
IF(C25=“”,””,IFERROR(VLOOKUP(C25,’Sheet1’!$A:$G,2,False), 2nd lookup)

=IF(C2="","",IFERROR(VLOOKUP(C25,’Sheet1’!$A:$G,2,False),VLOOKUP(C25,’Sheet2’!$C:$D,2,False) ))

you can add another IFERROR for 3rd lookup

=IF(C2="","",IFERROR(VLOOKUP(C25,’Sheet1’!$A:$G,2,False), IFERROR ( VLOOKUP(C25,’Sheet2’!$E:$F,2,False) ) ))
 
Upvote 0
try using IFERROR
IF(C25=“”,””,IFERROR(VLOOKUP(C25,’Sheet1’!$A:$G,2,False), 2nd lookup)

=IF(C2="","",IFERROR(VLOOKUP(C25,’Sheet1’!$A:$G,2,False),VLOOKUP(C25,’Sheet2’!$C:$D,2,False) ))

you can add another IFERROR for 3rd lookup

=IF(C2="","",IFERROR(VLOOKUP(C25,’Sheet1’!$A:$G,2,False), IFERROR ( VLOOKUP(C25,’Sheet2’!$E:$F,2,False) ) ))
The formula worked well for the first two lookups, but I was not able to do a 3rd lookup.

=IF(C25="","",IFERROR(VLOOKUP(C25,’Sheet1’!$A:$G,2,False),VLOOKUP(C25,’Sheet2’!$C:$D,2,False))))

But when I tried to add the third with another IFERROR - it did not work. He is the 3rd formula:

C2="","",IFERROR(VLOOKUP(C25,’Sheet3’!C$24:D$36,2,False)
 
Upvote 0
this works without the sheets as a quick test

=IF(C25="","",IFERROR(VLOOKUP(C25,'sheet1'!$A:$G,2,FALSE),IFERROR(VLOOKUP(C25,'sheet2'!$C:$D,2,FALSE),IFERROR(VLOOKUP(C25,'Sheet3'!C$24:D$36,2,FALSE),"X"))))

Mocked up here , in 1 sheet , just to show it work

Book2.xlsx
ABCDEFGHIJKLMNOP
1`REGULAR
2A0B0C0D0E0F0G0H03rd-1
3A1B1C1DoE1F1G1H1
4A2B2C2DoE2F2G2H2
5A3B3C3DoE3F3G3H3
6A4B4C4DoE4F4G4H4
7A5B5C5DoE5F5G5H5
8A6B6C6DoE6F6G6H6
9A7B7C7DoE7F7G7H7
10A8B8C8DoE8F8G8H8
11A9B9C9DoE9F9G9H9
12A10B10C10DoE10F10G10H10
13A11B11C11DoE11F11G11H11
14
15
16
17
18
19
20
21
22
23
24
2512343rd-11234
2612353rd-2
2712363rd-3
2812373rd-4
2912383rd-5
3012393rd-6
Sheet1
Cell Formulas
RangeFormula
M2M2=IF(P25="","",IFERROR(VLOOKUP(P25,$A:$G,2,FALSE),IFERROR(VLOOKUP(P25,$C:$D,2,FALSE),IFERROR(VLOOKUP(P25,C$24:D$36,2,FALSE),"X"))))
 
Upvote 0
The formula worked well for the first two lookups, but I was not able to do a 3rd lookup.

=IF(C25="","",IFERROR(VLOOKUP(C25,’Sheet1’!$A:$G,2,False),VLOOKUP(C25,’Sheet2’!$C:$D,2,False))))

But when I tried to add the third with another IFERROR - it did not work. He is the 3rd formula:

C2="","",IFERROR(VLOOKUP(C25,’Sheet3’!C$24:D$36,2,False)
this works without the sheets as a quick test

=IF(C25="","",IFERROR(VLOOKUP(C25,'sheet1'!$A:$G,2,FALSE),IFERROR(VLOOKUP(C25,'sheet2'!$C:$D,2,FALSE),IFERROR(VLOOKUP(C25,'Sheet3'!C$24:D$36,2,FALSE),"X"))))

Mocked up here , in 1 sheet , just to show it work

Book2.xlsx
ABCDEFGHIJKLMNOP
1`REGULAR
2A0B0C0D0E0F0G0H03rd-1
3A1B1C1DoE1F1G1H1
4A2B2C2DoE2F2G2H2
5A3B3C3DoE3F3G3H3
6A4B4C4DoE4F4G4H4
7A5B5C5DoE5F5G5H5
8A6B6C6DoE6F6G6H6
9A7B7C7DoE7F7G7H7
10A8B8C8DoE8F8G8H8
11A9B9C9DoE9F9G9H9
12A10B10C10DoE10F10G10H10
13A11B11C11DoE11F11G11H11
14
15
16
17
18
19
20
21
22
23
24
2512343rd-11234
2612353rd-2
2712363rd-3
2812373rd-4
2912383rd-5
3012393rd-6
Sheet1
Cell Formulas
RangeFormula
M2M2=IF(P25="","",IFERROR(VLOOKUP(P25,$A:$G,2,FALSE),IFERROR(VLOOKUP(P25,$C:$D,2,FALSE),IFERROR(VLOOKUP(P25,C$24:D$36,2,FALSE),"X"))))
A great solution. Thank you very much for your help.

Now, tell me about the final “X” at the end? That is what I left off when I was trying to complete it on my own.
 
Upvote 0
thats was just to show the final IFERROR , rather then N/A - so if it cannot find the item even in the 3rd vlookup - it will report something , part of my tes
So change that to something meaningful , then you wont get N/A error

so replace the X with - Not Found - or invalid or whatever you want

remove the last iferror

=IF(C25="","",IFERROR(VLOOKUP(C25,'sheet1'!$A:$G,2,FALSE),IFERROR(VLOOKUP(C25,'sheet2'!$C:$D,2,FALSE),VLOOKUP(C25,'Sheet3'!C$24:D$36,2,FALSE) )))

and you will get

N/A of all 3 vlookups can not find C25
 
Upvote 0
Solution

Forum statistics

Threads
1,214,951
Messages
6,122,446
Members
449,083
Latest member
Ava19

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
Back
Top