how do i change the formula to pull from the relevant tab?

bigdan

Well-known Member
Joined
Oct 5, 2009
Messages
844
Office Version
  1. 2013
Platform
  1. Windows
Hi folks, question please.
So Col A has the names of tab names in an external file.
Cell B1 shows the formula I need. I want to drag that formula down but I want to change the tab name in each instance.
How would I do this?

ABC=[F23_Q2FCST_Procurement.xlsx]ABC!$CD$80
DEF
GHI
JKL
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Excel Formula:
B1=INDIRECT("[F23_Q2FCST_Procurement.xlsx]"&A1&"!$CD$80")
 
Upvote 0
Solution
holy **** crap that worked!! thanks so much buddy
 
Upvote 0
i've tried this again but this time it's not working. i wonder if you can advise? I'm getting a REF error.

Tab=SUM(test!A1:A10) (sample formula)
ABC=INDIRECT("SUM("&A2&"!A1:A10)")
DEF
 
Upvote 0
Try it like
Excel Formula:
=SUM(INDIRECT("'"&A2&"'!A1:A10"))
 
Upvote 0
Try it like
Excel Formula:
=SUM(INDIRECT("'"&A2&"'!A1:A10"))

yes that works, thanks! can you tell me why that worked and mine didnt?

and unless i'm mistaken that code once simplified looks like this (keep in mind the value at cell A2 is "ABC") -> =SUM('ABC'!A1:A10)

most notably there's a single quote before and after the tab name. but i believe the correct syntax to reference that tab when doing so directly is =SUM(ABC!A1:A10) ie no quotes. so why the change?
 
Upvote 0
Some sheet names need to be enclosed in apostrophes, so I tend to put them in regardless, it just makes it more robust.
 
Upvote 0
Some sheet names need to be enclosed in apostrophes, so I tend to put them in regardless, it just makes it more robust.
ok thanks. but why did your formula work and not mine? simply b/c of the quotes?
 
Upvote 0
You hade the whole construct wrong, which is why it didn't work. The Indirect function needs to be wrapped in Sum, not the other way round.
 
Upvote 0

Forum statistics

Threads
1,216,583
Messages
6,131,557
Members
449,655
Latest member
Anil K Sonawane

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