Cumulative total across columns and specifying which columns to include using a variable

orangebloss

Board Regular
Joined
Jun 5, 2013
Messages
51
Office Version
  1. 365
Platform
  1. Windows
Hi

I've got a set of data that each week I need to run a report to see what the cumulative total should be
Is there a way I can do this in a formula?

ABCDE
117/04
217/0217/0317/0417/05
315102010

I would like to perform a total based on the value in B1 :
Sum values that are in the columns preceeding the column with the title in B1 (i.e. 15+10 )
Sum values that are in the columns from the column with the title in B1 (i.e. 20+10)

Any advice?

Thanks in advance

C
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Somebody will probably come up with an easier solution, but until that happens, please try this. I assumed you wanted to eventually add up more rows of data in each column so I created some dummy data. Cells A2 and B2 are the answer. Column A and B are added to summarize the values. Range C2:F2 are formulas to test based on the value in C1.

Jeff


Excel 2012
ABCDEF
117/04
2697782BeforeBeforeAfterAfter
3BeforeAfter17/0217/0317/0417/05
4253015102010
5273216112111
6293417122212
7313618132313
8333819142414
9354020152515
10374221162616
11394422172717
12414623182818
13434824192919
14455025203020
15475226213121
16495427223222
17515628233323
18535829243424
19556030253525
20576231263626

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
A2=SUM(A4:A20)
B2=SUM(B4:B20)
C2=IF(C3<$C$1,"Before","After")
D2=IF(D3<$C$1,"Before","After")
E2=IF(E3<$C$1,"Before","After")
F2=IF(F3<$C$1,"Before","After")
A4=SUMIFS(C4:F4,$C$2:$F$2,A$3)
B4=SUMIFS(C4:F4,$C$2:$F$2,$B$3)
A5=SUMIFS(C5:F5,$C$2:$F$2,A$3)
B5=SUMIFS(C5:F5,$C$2:$F$2,$B$3)
A6=SUMIFS(C6:F6,$C$2:$F$2,A$3)
B6=SUMIFS(C6:F6,$C$2:$F$2,$B$3)
A7=SUMIFS(C7:F7,$C$2:$F$2,A$3)
B7=SUMIFS(C7:F7,$C$2:$F$2,$B$3)
A8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
E11=1+E10
F11=1+F10
C12=1+C11
D12=1+D11
E12=1+E11
F12=1+F11
C13=1+C12
D13=1+D12
E13=1+E12
F13=1+F12
C14=1+C13
D14=1+D13
E14=1+E13
F14=1+F13
C15=1+C14
D15=1+D14
E15=1+E14
F15=1+F14
C16=1+C15
D16=1+D15
E16=1+E15
F16=1+F15
C17=1+C16
D17=1+D16
E17=1+E16
F17=1+F16
C18=1+C17
D18=1+D17
E18=1+E17
F18=1+F17
C19=1+C18
D19=1+D18
E19=1+E18
F19=1+F18
C20=1+C19
D20=1+D19
E20=1+E19
F20=1+F19

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,977
Members
449,200
Latest member
Jamil ahmed

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