How to use the value from a column to refer to a specific spreadsheet

miamianderson

New Member
Joined
Dec 4, 2014
Messages
11
Column A is a list of job titles. I have separate worksheets within the same workbook that are each named with each job title. In column B I am looking for a way to sum a particular array of cells in each worksheet. I was hoping to to be able to write a formula and drag it down my page, where within the formula it would identify which worksheet I want to reference (based on the value in column A). I tried the "Indirect" function, but kept on getting a "#REF!" error, and as I've never used that formula before, I'm clearly doing something wrong. Any guidance is super appreciated.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,023
Office Version
  1. 365
Platform
  1. Windows
Please post your formula, so we can see what you are doing.
 

miamianderson

New Member
Joined
Dec 4, 2014
Messages
11
If Column A is the list of the names of all the worksheets, and on each worksheet I want to pull the sum of cells O2:O50, in Column B, next to the name of each worksheet, what I was trying was something like "=SUM('INDIRECT("A4")'!O2:O50)"
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,023
Office Version
  1. 365
Platform
  1. Windows
Try writing it like this:
=SUM(INDIRECT("'" & A4 & "'!O2:O50"))
 

miamianderson

New Member
Joined
Dec 4, 2014
Messages
11

ADVERTISEMENT

I appreciate the help.

However, it returns a #REF! error.

Is there a way for me to upload/attach a demo workbook?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,915
Office Version
  1. 365
Platform
  1. Windows
What is the value in A4?
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,023
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

However, it returns a #REF! error.
That seems to suggest that there is no sheet in your workbook with the name of what is appearing in cell A4.
Make sure that you do not have any extra spaces at the beginning or end.
 

miamianderson

New Member
Joined
Dec 4, 2014
Messages
11
Stupid clerical error... you found the problem... thank you so much. There was an extra space on the worksheet name.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,023
Office Version
  1. 365
Platform
  1. Windows
You are welcome.
Glad we were able to help.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,212
Messages
5,640,897
Members
417,177
Latest member
njosh

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
Top