Sum column data based on dynamic header

y2gabs

New Member
Joined
Mar 24, 2006
Messages
15
Hi there,

I figured this would be easy but seem to be stumped. I have a large data table with various dates representing header row (column headers). What I would like to do is sum a column based on a date selected. For example:

July 1 | July 5 | July 9
4 | 7 | 22
3 | 6 | 34

If I have a separate worksheet with a cell called "July 1", I'd like the cell beside that cell to sum all of the values in the column on the data sheet with column header "July 1".

I've tried various iterations of Match and Index but really seem to be stumped. Any help would be huge!

Thanks!

P.S. many apologies if this already exists in another thread. I've done some extensive searching but may be getting my queries wrong.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try something like this...

=SUM(INDEX(Sheet1!A2:D4,0,MATCH(A1, Sheet1!A1:D1,0)))

Sheet1!A2:D4 = Columns of Data to sum

Sheet1!A1:D1 = column headers

A1 = date to match in column headers
 
Upvote 0
This should do it. In this example, all of the data and formulas are on the same sheet, however, it shouldn't be any problem at all to change the reference to your sheet.

Excel 2007
ABCDEFG
17/1/20127/5/20127/9/2012
247225-Jul13
33634

<COLGROUP><COL><COL><COL><COL><COL><COL><COL><COL></COLGROUP><THEAD>
</THEAD><TBODY>
</TBODY>
Sheet1

Worksheet Formulas
CellFormula
G2=SUM(OFFSET(A2:A65000,0,MATCH(F2,1:1,0)-1))

<THEAD>
</THEAD><TBODY>
</TBODY>

<TBODY>
</TBODY>

Just make sure the data type is the same in your column headers (A1:C1) as it is in your lookup value (F2).
i.e. both text, both dates, etc.
 
Upvote 0

Forum statistics

Threads
1,216,496
Messages
6,130,983
Members
449,611
Latest member
Bushra

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