Lookup value in another "random" workbook

wadergirl

New Member
Joined
Jun 3, 2016
Messages
49
So, I'm not even sure if this is possible.

I would like a formula (or maybe could do a macro if needed), but what I'm trying to do is basically this:

In cell B1:
1. Take a value from cell A1 in Workbook A.
2. Search for that value on ANY tab in ANY workbook in file path "P:\shared\2019" which has multiple subfolders (i.e. 02 2019, 03 2019, 04 2019, etc) - workbooks are mostly named by date (i.e. 01.01.19.xlsx) so theres no more than approx. 31 files per folder, but obviously it varies
3. Return the file name of the FIRST file the value is found on

In cell C1: same as above, but return the tab name of that file (3 possible tabs on each file)

In cell D1 & E1: same as above, but with the SECOND file the value is found on

In cell F1 & G1: same as above, but with the THIRD file the value is found on

There would be no more than 3 files it would be on and would repeat for all values in column A.
If this can be done with a formula, I could probably narrow down which subfolder in the file path to search in and just change it for each row as applicable, since I know the approximate frame each value should appear in.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi Wadergirl,
that sounds like a macro to me, not something you could do in a simple function. Excel will have to open all those files and search in every one of them. In that macro, step 1 would be to list all files in that folder & subfolders, e.g. like so: https://www.mrexcel.com/forum/excel...-way-listing-folders-subfolders-contents.html
Next step: you could open every file for every search term, but that would be rather slow. Say you have 365 files and 100 search terms, that would mean opening and closing 36500 times, which takes a looooong time. So it's probably easier to open every file once and search for all the terms you want to search for and write those results in a sheet and as step 3 process them into the format you want.
Hope that gets you started, don't hesitate to post your code if you get stuck.
Kind regards,
Koen
 
Upvote 0
Solution

Forum statistics

Threads
1,223,723
Messages
6,174,108
Members
452,544
Latest member
aush

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