Name the source of sheetname from Vstack

dandelion

New Member
Joined
Jul 16, 2022
Messages
33
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi,

I am using a Vstack formula to combine data from multiple sheets. Do you know which formula or how I can show in column A the name of sheet that the data was fetched? I don't want to use Power Query. TIA
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Get the formula using FormulaText, such as:
Excel Formula:
=FORMULATEXT(A2)
Then parse the text you get

But that's a strange request, as who put the formula there should know its parametres; or is it a dynamic range, or a result from other calculations (maybe in a LET)?
 
Upvote 0
What is the formula you are using?
 
Upvote 0
What is the formula you are using?
This is the formula:
=FILTER(VSTACK(SalaryCosts:TravelCosts!B11:N10000),VSTACK(SalaryCosts:TravelCosts!B11:B10000) <> "").
From Salary Costs and Travel Costs, there are multiple Cost sheets as well.
 
Upvote 0
Ok, to start with you need to create a define name, on the Formula tab click Name Manager, New & call is ShtNames & then put this formula in the refers to box
Excel Formula:
=TOCOL(TEXTAFTER(GET.WORKBOOK(1)&T(NOW()),"]"))
Then in the sheet you can use
Excel Formula:
=LET(s,SEQUENCE(ROWS(ShtNames)),Shts,FILTER(ShtNames,(s>=MATCH("SalaryCosts",ShtNames,0))*(s<=MATCH("TravelCosts",ShtNames,0))),FILTER(VSTACK(HSTACK(Shts,SalaryCosts:TravelCosts!B11:N10000)),VSTACK(SalaryCosts:TravelCosts!B11:B10000) <> ""))
 
Upvote 0
Ignore the sheet formula it's wrong, it should be
Excel Formula:
=LET(s,SEQUENCE(ROWS(ShtNames)),Shts,FILTER(ShtNames,(s>=MATCH("SalaryCosts",ShtNames,0))*(s<=MATCH("TravelCosts",ShtNames,0))),List,TOCOL(IF(SEQUENCE(,ROWS(B11:B10000)),Shts)),FILTER(HSTACK(List,VSTACK(SalaryCosts:TravelCosts!B11:N10000)),VSTACK(SalaryCosts:TravelCosts!B11:B10000) <> ""))
 
Upvote 0
Ignore the sheet formula it's wrong, it should be
Excel Formula:
=LET(s,SEQUENCE(ROWS(ShtNames)),Shts,FILTER(ShtNames,(s>=MATCH("SalaryCosts",ShtNames,0))*(s<=MATCH("TravelCosts",ShtNames,0))),List,TOCOL(IF(SEQUENCE(,ROWS(B11:B10000)),Shts)),FILTER(HSTACK(List,VSTACK(SalaryCosts:TravelCosts!B11:N10000)),VSTACK(SalaryCosts:TravelCosts!B11:B10000) <> ""))
Thanks. What does "Shts" refer to?
 
Upvote 0
It's just the name of a variable that holds the filtered array of sheet names.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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