Cell Reference as Sheet name

aliaslamy2k

Active Member
Joined
Sep 15, 2009
Messages
416
Office Version
  1. 2019
Platform
  1. Windows
Dear Experts,


I want to modify this formula to read cell reference as Sheet name. I tried entering as "'"&B14&"'! But it gives me an error.


L 0 =IF(ROWS(D$14:D14)>$D$12,"",INDEX("'"&B14&"'!$B$4:$B$37,SMALL(IF(("'"&B14&"'!$A$4:$A$37=$B$14),ROW("'"&B14&"'!$B$4:$B$37)-ROW("'"&B14&"'!$B$4)+1),ROWS(D$14:D14))))



DRLJHCountriesTotalD
Assigned CountriesTotal AssignedAssigned CountriesTotal AssignedAssigned CountriesTotal AssignedAssigned CountriesTotal AssignedAssigned CountriesTotal AssignedTunisia361R
Tunisia361659India95232Kyrgystan50140Lebanon266286Lebanon192219India198L
India103Sri Lanka102Russia90Kyrgystan20Spain27Sri Lanka194J
Sri Lanka92Kenya35Kenya138H
Kenya103Lebanon458
Kyrgystan70
Spain27
Russia90
Total1536
L0 =IF(ROWS(D$14:D14)>$D$12,"",INDEX("'"&B14&"'!$B$4:$B$37,SMALL(IF(("'"&B14&"'!$A$4:$A$37=$B$14),ROW("'"&B14&"'!$B$4:$B$37)-ROW("'"&B14&"'!$B$4)+1),ROWS(D$14:D14))))
 

Attachments

  • Excel Question 2.png
    Excel Question 2.png
    9.6 KB · Views: 8

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You need INDIRECT. So instead of this:

Excel Formula:
"'"&B14&"'!$A$4:$A$37

you'd use this:

Excel Formula:
INDIRECT("'"&B14&"'!$A$4:$A$37")

Note that this will make your formulas volatile so that they will recalculate whenever an open workbook does, even if their inputs haven't changed.
 
Upvote 0
Dear RoryA,

I am really sorry, i am not sure how to embed this in my formula. I would highly appreciate if you could add this in my formula.


I tried like this but its not working.

=IF(ROWS(D$14:D14)>$D$12,"",INDEX(INDIRECT("'"&B14&"'!$A$4:$A$37")$B$4:$B$37,SMALL(IF((INDIRECT("'"&B14&"'!$A$4:$A$37")$A$4:$A$37=$B$14),ROW(INDIRECT("'"&B14&"'!$A$4:$A$37")$B$4:$B$37)-ROW("'"&B14&"'!$B$4)+1),ROWS(D$14:D14))))
 
Upvote 0
Like this:

Excel Formula:
=IF(ROWS(D$14:D14)>$D$12,"",INDEX(INDIRECT("'"&B14&"'!$B$4:$B$37"),SMALL(IF((INDIRECT("'"&B14&"'!$A$4:$A$37")=$B$14),ROW(INDIRECT("'"&B14&"'!$A$4:$A$37"))-ROW(INDIRECT("'"&B14&"'!$B$4"))+1),ROWS(D$14:D14))))

given that this is an array formula, if you have a lot of these, I would really advise against using INDIRECT but you can test it and see what performance is like for you.
 
Upvote 0
Solution
Like this:

Excel Formula:
=IF(ROWS(D$14:D14)>$D$12,"",INDEX(INDIRECT("'"&B14&"'!$B$4:$B$37"),SMALL(IF((INDIRECT("'"&B14&"'!$A$4:$A$37")=$B$14),ROW(INDIRECT("'"&B14&"'!$A$4:$A$37"))-ROW(INDIRECT("'"&B14&"'!$B$4"))+1),ROWS(D$14:D14))))

given that this is an array formula, if you have a lot of these, I would really advise against using INDIRECT but you can test it and see what performance is like for you.


Dear RoryA,

Thank You so much. The formula is working very well. Thanks a million once again.
 
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,326
Members
453,032
Latest member
Pauh

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