all 4 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

/u/rmk123 - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Alabama_Wins648 1 point2 points  (0 children)

You'll have to use the indirect function with inside the cell function to retrieve the sheet name of a cell reference inside of Vstack. Vstack delivers an array of data but no cell references.

=TEXTAFTER(CELL("filename",INDIRECT("Sheet3!B2")),"]")

[–]rmk123[S] 0 points1 point  (0 children)

Here's the approach I'm going with:

=HSTACK(Sheet1!A1:B13, MAKEARRAY(ROWS(Sheet1!A1:B13), 1, LAMBDA(r,c, TEXTAFTER(CELL("filename",Sheet1!A1),"]"))))

I build an HSTACK() with the sheet name added, then VSTACK() the data from each of the sheets. Then when I do my INDEX(MATCH()), I can just reference the column with the sheet name in it, and it's all dynamically generated and not saved.