How can I add specific text to build cell references to an external workbook?

emaildon

New Member
Joined
Jun 1, 2019
Messages
5
Hi

I have a workbook ("Analysis") that has multiple sheets querying another workbook ("EnquiriesDataExport"). "EnquiriesDataExport" is automatically exported from our system every 24 hours so it needs to be separate from my "Analysis".

Each sheet in "Analysis" will be the same except that the cells in each sheet will query different worksheets in "EnquiriesDataExport"

A typical cell in one "Analysis" worksheet might be:

=COUNTIFS([EnquiriesDataExport.xlsx]Interviews!$A:$A,">="&C$1,[EnquiriesDataExport.xlsx]Interviews!$A:$A,"<="&D$1,[EnquiriesDataExport.xlsx]Interviews!$C:$C,$A2)

in a second worksheet the formula will be:

=COUNTIFS([EnquiriesDataExport.xlsx]Telcons!$A:$A,">="&C$1,[EnquiriesDataExport.xlsx]Telcons$A:$A,"<="&D$1,[EnquiriesDataExport.xlsx]Telcons!$C:$C,$A2)

in a third worksheet the formula will be:

=COUNTIFS([EnquiriesDataExport.xlsx]Meetings!$A:$A,">="&C$1,[EnquiriesDataExport.xlsx]Meetings!$A:$A,"<="&D$1,[EnquiriesDataExport.xlsx]Meetings!$C:$C,$A2)

etc etc

I'd like to set up a standard sheet for the "Analysis" workbook whereby with a drop down menu which i could get all of the cells to reference the required sheet. e.g. Interviews, Telcons, Meetings.

Is there a way to do this so that my formula could "build" itself with the chosen value inserted into the string?

If i choose "Interviews" in Cell A1 dropdown then Cell A2 would change from:

=COUNTIFS([EnquiriesDataExport.xlsx]Meetings!$A:$A,..

to

=COUNTIFS([EnquiriesDataExport.xlsx]Interviews!$A:$A,..

Sorry for the long winded explanation. I've looked at CONCATENATE and INSERT but can't find a way to do what I want to do. Perhaps there is a better way altogether. Any ideas or prompts gratefully received.

Thanks
Don
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi & welcome to MrExcel.
You can use INDIRECT like
=COUNTIFS(INDIRECT("'[EnquiriesDataExport.xlsx]"&A1&"'!$A:$A"),">="&C$1,INDIRECT("'[EnquiriesDataExport.xlsx]"&A1&"'!$A:$A"),"<="&D$1,INDIRECT("'[EnquiriesDataExport.xlsx]"&A1&"'!$C:$C"),$A2)
 
Upvote 0
Aye that works very well. Thank you. I've been trying to add in an extra INDIRECT to vary the column selection too but can't get it to work. Would you be able to suggest the format? Just as you did with the cell "A1" I'd like to also make "B1" refer to the column "A:A". Thanks for any tips.
 
Upvote 0
Try
=COUNTIFS(INDIRECT("'[EnquiriesDataExport.xlsx]"&A1&"'!"&B1)
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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