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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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

<COLGROUP><COL><COL><COL><COL><COL><COL><COL><COL></COLGROUP><THEAD>
</THEAD><TBODY>
[TD="align: center"]1[/TD]
[TD="align: right"]7/1/2012[/TD]
[TD="align: right"]7/5/2012[/TD]
[TD="align: right"]7/9/2012[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]5-Jul[/TD]
[TD="align: right"]13[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]34[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</TBODY>
Sheet1

[TABLE="width: 85%"]
<TBODY>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<THEAD>[TR="bgcolor: #e0e0f0"]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</THEAD><TBODY>[TR]
[TH="width: 10, bgcolor: #e0e0f0"]G2[/TH]
[TD="align: left"]=SUM(OFFSET(A2:A65000,0,MATCH(F2,1:1,0)-1))[/TD]
[/TR]
</TBODY>[/TABLE]
[/TD]
[/TR]
</TBODY>[/TABLE]

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,223,723
Messages
6,174,123
Members
452,546
Latest member
Rafafa

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