A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Yep - you can create an "Address Book" sheet in Folder 2 that contains the source sheet names and then make the FILTER formula dynamically use the selected sheet name. Use one cell that controls which source sheet is used.
Create an Excel sheet called AddressBook. Set it up with the following columns:
No. | Source Sheet | Description
1 | S1 | Fatigue Data - S1
2 | S2 | Fatigue Data - S2
3 | S3 | Fatigue Data - S3
4 | S4 | Fatigue Data - S4
You can continue adding S5, S6, S7, etc. as required.
Then create a control cell, for example AddressBook!E2, where you select the required source sheet. You can make E2 a drop-down list containing S1, S2, S3, S4, etc.
Your existing formula currently has S1 hard-coded into the external reference. Instead, the formula can take the sheet name from AddressBook!E2.
Use this formula:
=LET( SheetName,AddressBook!E2, SourceRange,INDIRECT("'Q:\Presentations\PE_31\O_Analysis and calculation\Fatigue\Backups_Marcros\Fatigue Assesment_as per 17949_Welded Joints[DB_Data_Collectives_2.xlsm]"&SheetName&"'!$C$6:$DB$105"), CheckRange,INDIRECT("'Q:\Presentations\PE_31\O_Analysis and calculation\Fatigue\Backups_Marcros\Fatigue Assesment_as per 17949_Welded Joints[DB_Data_Collectives_2.xlsm]"&SheetName&"'!$G$6:$DB$105"), FILTER(SourceRange,BYROW(CheckRange,LAMBDA(r,SUM(r)>0)),"N") )
With this arrangement, if AddressBook!E2 contains S1, the formula reads from S1. If you change E2 to S2, it automatically reads from S2. Changing it to S3 reads from S3, and so on. The FILTER formula itself does not need to be changed.
You can also make the Address Book use a numeric selection instead. For example, E2 could contain 1, 2, 3 or 4, while the Source Sheet column contains S1, S2, S3 and S4. In that case, the formula can retrieve the sheet name using XLOOKUP:
=LET( SheetName,XLOOKUP(AddressBook!E2,AddressBook!A:A,AddressBook!B:B), SourceRange,INDIRECT("'Q:\Presentations\PE_31\O_Analysis and calculation\Fatigue\Backups_Marcros\Fatigue Assesment_as per 17949_Welded Joints[DB_Data_Collectives_2.xlsm]"&SheetName&"'!$C$6:$DB$105"), CheckRange,INDIRECT("'Q:\Presentations\PE_31\O_Analysis and calculation\Fatigue\Backups_Marcros\Fatigue Assesment_as per 17949_Welded Joints[DB_Data_Collectives_2.xlsm]"&SheetName&"'!$G$6:$DB$105"), FILTER(SourceRange,BYROW(CheckRange,LAMBDA(r,SUM(r)>0)),"N") )
This second approach should work better if your Address Book is to become a larger control table because the user selects a number and the Address Book determines the corresponding worksheet.
Note that INDIRECT has a limitation with external workbooks - the referenced DB_Data_Collectives_2.xlsm workbook generally needs to be open for INDIRECT to resolve the dynamically constructed reference.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin