Bring values from variable count of sheets

inese_green

New Member
Joined
Apr 21, 2021
Messages
6
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hello! I hope you can all help me with my work. I'm working with multiple sheets, and the count of the sheets are variable. I have the main sheet DATA, and sheet2, sheet3....Sheets contain the same information, except the unique number of samples (Lab. No), what are changing. I need to get information from other sheets to DATA sheet, based on criteria (Lab. No). It would bring from sheet2, sheet3....exact values based on LAb. No. what is on Data sheet.
Like, for Lab. No. 123A456 it would bring for particle diameter 16.0 mm - 4.0, for 11.2 mm - 5.0...so on...
I'm wondering, is it possible to write formula what would fit for variable number of sheet? I I have 2 or 10 sheets, it can bring in Data sheet values based on Lab. No. from multiple sheets.
I hope, I set out clearly what I want to achieve!
Have a nice day!!!
 

Attachments

  • Data sheet.png
    Data sheet.png
    48.4 KB · Views: 8
  • Sheet2.JPG
    Sheet2.JPG
    87.3 KB · Views: 6
  • Sheet3.JPG
    Sheet3.JPG
    90 KB · Views: 7

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi inese_green,

This would be possible with VBA but I'll assume you want to use Functions.

Excel does have something called 3D functions which let you perform actions across multiple sheets but none of them let you just retrieve data ( see Excel 3D functions )

One method would be to use INDIRECT but it would require you to list the names of each worksheet. If that's acceptable then let me demonstrate. Here I have your Data tab and 4 other sheets with random data in row 3 and columns A to H.
1624354682696.png


On the Data sheet I enter the sheet names in column Z (out of the way) then for each cell I want to retrieve I construct the address for INDIRECT.
Excel Formula:
=IF($Z3="","",INDIRECT("'"&$Z3&"'!"&ADDRESS(3,COLUMN())))

The IF statement checks if I have a sheet name to avoid a #REF! error if nothing is found.

The INDIRECT then builds the address for each cell to retrieve. For the Lab No. of "This is Sheet4" I'll want to construct
Excel Formula:
='This is Sheet4'!A3
...so I put in a single quote (in case the sheet name contains a blank), pull the sheet name from column Z, end the single quotes and put the exclamation mark. For the cell address I'll always pull from row 3 but I want to pull from the same column as my formula so use ADDRESS, like this:
Excel Formula:
INDIRECT("'"&$Z5&"'!"&ADDRESS(3,COLUMN())))

inese_green.xlsx
ABCDEFGHIJYZ
1
2
3123456abcd555555Sheet2
4123457xdrt445566Sheet3
5123458hjkl222222This is Sheet4
6123459ppllwwwwx111111Sheet5 is here
7        
8
Data
Cell Formulas
RangeFormula
A3:H7A3=IF($Z3="","",INDIRECT("'"&$Z3&"'!"&ADDRESS(3,COLUMN())))
 
Upvote 0
Hi, Toadstool!
Thank you for your time and formulas! I went through the formulas what you where offered, but don't work in my case. It's not like it doesn't work, but it would be very difficult in this cases.

Would you advise me, how to write a code for VBA. Maybe you have some special YouTube channels what would you recommend for learning VBA?!
Than you!
 
Upvote 0
Hi Inese_Green,

I'm not a VBA programmer so can't offer that solution. Search the forum for "VBA Training" and you'll find some recommendations, like this: VBA online-training-courses

Good luck!
 
Upvote 0
Solution

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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