Sum table data with conditions and date in headers

jbellows

New Member
Joined
Apr 23, 2018
Messages
3
I am trying to figure out a way to solve an equation for summing data within a table based on date conditions (with date headers that have been converted to text by excel when VBA was refreshing the query) without having to use an array (I have a solution with DATEVALUE and an Array, see example.

=DATEVALUE(B2)4/30/20165/31/20166/30/20167/31/20168/31/20169/30/2016
Label4/30/20165/31/20166/30/20167/31/20168/31/20169/30/2016
100000 · Revenue5000000200000015000008000000100000007500000
130000 · Interest Income1000020005000400020001000
140000 · Misc. Income48201349612660.72021578.599467.38
150000 · Expense Reimbursement.121502.89400071320.5244920.3518303.5115560.75
Total Income5136322.8920194961588981.248048920.3510041882.17526028.13
This will be on another sheet
Start Date4/30/20166/30/2018
End Date6/30/20169/30/2018
100000 · Revenue
Total Income
Current solution8500000=SUM(IF($A2:$A13=$A17,IF(($A$1:$G$1<=B16)*($A$2:$G$2>=DATE(YEAR(B15),1,1)),$A2:$G13, 0), 0))

<tbody>
</tbody>
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
not sure what exactly you need. do you just need a sum of row value that is between the start and end date? you can use a combination of match, indirect (?), and sumifs, no?

=sumifs(match(A17,A2:13,0),$1:$1,">=" & Start_Date, $1:$1,"<=" & End_Date)

something like that. You might need to change match(A17,A2:13,0) to indirect(match(A17,A2:13,0)&":"&match(A17,A2:13,0)) to select the row number for sumifs
 
Upvote 0
Trying to be able to do this within a table reference structure if possible, as this table is refreshed with a query and changes is size regularly. Also, the dates are text in the headers, and not values. When the query is run in VBA and refreshes the table, it is converted to text when it is used as a Header of the table.
 
Upvote 0
yes i understand, so everything under row 2 is table and your date value is a calc based of header row. your inputs for sum in the current selection is start date, end date, and 10000 Revenue (which you are looking up against column A of that table).

why can't you use my formula? I missed that part that you said its on a separate sheet so you'll need to add sheet reference in front of all the ranges.
 
Upvote 0
I am trying to be able to get rid of the DATEVALUE and the array formulas, and to be able to figure out how to achieve the formula using table references (i.e. sumifs(Table,Table[label],A17,Table[Headers#],">="&StartDate,Table[Headers#],"<="&EndDate)). I cannot figure out how to get a formula to see and use the table headers as formulas.
 
Upvote 0

Forum statistics

Threads
1,215,067
Messages
6,122,949
Members
449,095
Latest member
nmaske

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