Search code examples
google-sheetsvariablesfiltertabsinterrupt

Google sheets: Insert a cell variable to determine tab name


I'm looking to have my Google sheet pull in a random tab to populate its fields. I have a =RANDBETWEEN giving me a number, and I'm looking to have something like:

=FILTER('Story 1'!2:2,'Story 1'!2:2<>"") but where I can change out the "1" in "Story 1" for the digit generated by the RANDBETWEEN. How can I interrupt this properly?

I've tried a couple of INDIRECT calls but I can't get it to parse right.


Solution

  • Use INDIRECT() in this way-

    =FILTER(INDIRECT("'Story " & RANDBETWEEN(1,5) & "'!2:2"),INDIRECT("'Story " & RANDBETWEEN(1,5) & "'!2:2")<>"")