Search for value across multiple columns, workbooks, and sheets then return a cell value?

qplsn9

New Member
Joined
Dec 5, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hello, I want to search for the Label ID in multiple sheets within a workbook. For example, I want to search for "WD734895" in cell A2 in Book1 within the contents of the workbook 2024.01.xlsx and in all sheets within that workbook. Once it is found, I would like to return the cell value that contains the Z#. For example, "WD734895" is searched in 2024.01.xlsx, and if found (located in 2024.01.xlsx cell F14), it will return Z2. I would like to do this will the tray and slot as well.

Along with that, is it possible to do the same above but instead of returning the Z#, if found, it will return the workbook name "2024.01" with the sheet named concatenated on "30" with a "." in between? So search "WD734895" in 2024.01.xlsx and, if found, it will return the value "2024.01.30" in cell C2?

Screenshot 2023-12-05 102642.png
2024.01 sheets.png


Clarification: for trays and slots, I want to return the tray and slot (located in A2 and B2 respectively for Z1) if "WD734895" is found within the workbook.
 
Last edited by a moderator:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi, this could be done with power query and/or VBA, but... and I know what I'm about to tell you is not what you asked, but I'll do it anyways with the intention of saving you some headaches.
In MHO you should structure you database differently. Of course if this isn't an option just ignore the rest of my post.
I tell you what I would do:
I would unify all data in the files and sheets into one sheet and structure the data like so and convert it into a table:

DateZ#Label IDTraySlot
28/01/2024Z1BE36545511
28/01/2024Z2VU24395122
29/01/2024Z1GT68998134
29/01/2024Z1JS58914411
29/01/2024Z2CZ14680721
30/01/2024Z1IU12183711
30/01/2024Z2JS20759821
30/01/2024Z2UV64676411
01/02/2024Z1ZH69966821
01/02/2024Z2CI58868831
01/02/2024Z3HQ31408712
05/03/2024Z1JM64968814
05/03/2024Z1LF55645411
01/02/2024Z1SD73155512
01/02/2024Z2BC48157823
01/02/2024Z3PT74109144


For every book you create a new row with the date, the Z#, Label ID, Tray and Slot (in any order you like). I know this may be a lot of work but with this you could easily find what you need quick.
You could search by book:

filterByBook.png


Or by a specific date or dates:

filterByDates.png


And with your database structured like this you can also do lookups with simple fomulas very easily.

To transform your database you could use power query of VBA to automate the process as much as possible.

I apologice again for not answering you question but i really think you should try this.
 
Upvote 0
Hi, this could be done with power query and/or VBA, but... and I know what I'm about to tell you is not what you asked, but I'll do it anyways with the intention of saving you some headaches.
In MHO you should structure you database differently. Of course if this isn't an option just ignore the rest of my post.
I tell you what I would do:
I would unify all data in the files and sheets into one sheet and structure the data like so and convert it into a table:

DateZ#Label IDTraySlot
28/01/2024Z1BE36545511
28/01/2024Z2VU24395122
29/01/2024Z1GT68998134
29/01/2024Z1JS58914411
29/01/2024Z2CZ14680721
30/01/2024Z1IU12183711
30/01/2024Z2JS20759821
30/01/2024Z2UV64676411
01/02/2024Z1ZH69966821
01/02/2024Z2CI58868831
01/02/2024Z3HQ31408712
05/03/2024Z1JM64968814
05/03/2024Z1LF55645411
01/02/2024Z1SD73155512
01/02/2024Z2BC48157823
01/02/2024Z3PT74109144


For every book you create a new row with the date, the Z#, Label ID, Tray and Slot (in any order you like). I know this may be a lot of work but with this you could easily find what you need quick.
You could search by book:

View attachment 102983

Or by a specific date or dates:

View attachment 102985

And with your database structured like this you can also do lookups with simple fomulas very easily.

To transform your database you could use power query of VBA to automate the process as much as possible.

I apologice again for not answering you question but i really think you should try this.
I appreciate the reply! This is a great idea, unfortunately changing the format of our spreadsheets would require a complete overhaul of our entire workflow as the data that is input in the 2024.01.xlsx (aka monthly log) comes from another spreadsheet that is exported and copied and pasted into our monthly log and attempting to change this would require a lot more work. Thank you for your input though!
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

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