Changing Cell References based on value in drop down box.

Heinrad

New Member
Joined
Apr 18, 2018
Messages
2
Good Afternoon,

I have come unstuck with an Excel sheet we have after trying to automate part of the document.

This spreadsheet tracks costs over a year based on what week it is. Each member of staff has a spreadsheet seperate to this one where they fill in data, and that data is referenced in this other workbook and populates accordingly.

For the overall year, it works fine, it looks at the individuals spreadsheet and adds together all 52 weeks then produces the total.

My boss asked me to produce numbers for the past 4 weeks. To quickly get it done, I simply changed the cell references to the current week and the entry from 4 weeks ago and summed them together. The formula looks something along the lines of =SUM('filelocation\[DOCUMENT.XLS]Sheet1'!C5:C56)

I was wondering if there was a way where, if I set the week number to '10', either by text entry or drop down menu, it could change the cell references to match without me having to edit each individual user. In this case, if week 10 was selected, the formula would change to the sum of C11:C14.

Thank you for your help.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
have a look of the indirect() function,

e.g =sum(A4:A7) can be rewritten as

=SUM(INDIRECT("A"&A1+1&":A"&A1+4))

with 3 as variable in Cell A1
 
Upvote 0
Thanks for the response, that does look like what I am looking for. Does this function work when referencing a different workbook? If so, how does that look?

I'm not sure how to build the function when it uses ('filelocation\[DOCUMENT.XLS]Sheet1'!C5:C56) to look at a seperate file.
 
Upvote 0
for example you have data in book1 Sheet1 like this


Excel 2013/2016
A
11
22
33
44
55
66
77
88
99
1010
1111
1212
1313
1414
1515
1616
1717
1818
1919
2020
Sheet1


and you wanted to sum up 4 weeks after week 10 in book 2


Excel 2013/2016
A
110
2
3
450
Sheet1
Cell Formulas
RangeFormula
A4=SUM([Book1.xlsx]Sheet1!$A$11:$A$14)


to have it dynamically, e.g. week 10 in A1, with indirect()


Excel 2013/2016
A
110
2
3
450
5
650
Sheet1
Cell Formulas
RangeFormula
A6=SUM(INDIRECT("'[Book1.xlsx]Sheet1'!A"&A1+1&":A"&A1+4))
 
Upvote 0

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

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