Read data from anotherworkbook/tab

humanoid769

New Member
Joined
Feb 14, 2020
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hi

I am trying to setup an =IF statement to lookup a value from a certain tab1 within a workbook based upon a field. So if B2=Money Map 1 then go to mony map 1 tab if it is Money Map 2 then read from money map 2 tab if anything else then leave it 0.

I currently have:

=IF(B2="Money Map 1",VLOOKUP(A4,'H:\Downloads\[1b. Pro Tactics BSP Order.xlsm]Money Map 1'!$A$611:$AB$33837,24,FALSE),IF(B2="Money Map 2",VLOOKUP(A4,'H:\Downloads\[1b. Pro Tactics BSP Order.xlsm]Money Map 2'!$A$611:$AB$33837,24,FALSE),0))

But it always returns a 0

Any advice please

Thanks
Tony
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi Tony,
I like to debug my formulas step by step using a combination of breaking the formula up into pieces, replacing parts of the formula with dummy values and using the "evaluate Formula" function in "Formulas" tab.

Here's the formula you were requesting. I haven't debugged your Vlookup, it's a waste of time. Just use X lookup.
You could further modify your LET function to include the path as a variable if you wished.
Excel Formula:
=LET(sheetName,B2,XLOOKUP(A4,INDIRECT("'H:\Downloads\[1b. Pro Tactics BSP Order.xlsm]"&sheetName&"'!$A611:$AB$33837"),INDIRECT("'H:\Downloads\[1b. Pro Tactics BSP Order.xlsm]"&sheetName&"'!$X1:$X33837"),"not found",0))

If you're finding the above isn't a direct drop in replacement, this is the formula I tested on a dummy worksheet.
Excel Formula:
=LET(sheetName,B2,XLOOKUP(A4,INDIRECT("'"&sheetName&"'!$A1:$A10"),INDIRECT("'"&sheetName&"'!$B1:$B10"),"not found",0))

1669867089409.png


1669867112189.png
 
Upvote 0
Solution

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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