Sum formula using another cell to input a change in the formula

lonmfrech

New Member
Joined
Jul 15, 2022
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
We keep track of the tons that we haul in our trucks. Each month since 1997 I have entered the tons we hauled each month. The data is categorized by the year and then the months for that year.

Each month of the current year, I want to be able to compare the amount of tons brought in from the beginning of the year to the current month of the current year to the past years from the beginning of the year to the current month for that past year.

In this example, I want the sum in the “Tons to Month” row for the 2021 column to Sum Jan through Jun, and I want the column for 2022 to add Jan through Jun of 2022.

Currently, I just make a Sum formula in “Tons to Month” and add up the tons from Jan to Jun for each year.

Instead, what I want to do is have a formula in “Tons to Month” that would point to a cell where I enter “Jun” (this happens to be the current month that I am looking for the data for) and the formula returns the Sum of Jan through Jun. This way, I only enter “Jun” in one cell, and all the “tons to Month” get updated in each years’ column.



Year20212022
Tons to month 16,37616,299
Jan2,5722,635
Feb2,3522,327
Mar2,8762,767
Apr2,8772,638
May2,6382,813
Jun3,0623,117
Jul3,121102
Aug2,9250
Sep2,7470
Oct2,7200
Nov2,7840
Dec2,6080
 

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.
lonm, I usually get directions wrong. But we want to get the ball rollin. Now I came up with a solution that I thought should work. So below is the output. If you have some other idea for output, let us know. So the sum formula only starts when a number is entered into the new month. Let the decision begin.

Book1
ABCDE
1Year20212022
2Tons to month1637616299
3Jan189482572263518934
4Feb213002352232721261
5Mar241762876276724028
6Apr270532877263826666
7May296912638281329479
8Jun327533062311732596
9Jul358743121250035096
10Aug 2925200 
11Sep 27470 
12Oct 27200 
13Nov 27840 
14Dec 26080 
Data
Cell Formulas
RangeFormula
B3:B14B3=IF(D4>0,SUM($C$2:C3),"")
E3:E14E3=IF(D4>0,SUM($D$2:D3),"")
 
Upvote 0
Hi Ezguy4u,
If I understand your suggestion, this is essentially what I am doing, which is changing the Tons To Month formulas each month.
I would need to change your formula
=IF(D4>0,SUM($C$2:C3),"") from D4 to D5 each month in each of the “Tons to Month” column as the new data comes in to get the new sum for the Tons to Month.
(I should have included rows and columns in my post)
Using your spreadsheet example for cell identification, the way I’m currently doing it, I would change the Sum formula in each of the Tons to Month. C2, For May 2021, would be =Sum(C3:C7),
then for June 2021 it would be =Sum(C3:C8).

In your example for the same month to compare of May then June, the formula would change from
=IF(D7>0,SUM($C$2:C3),"") for tons through May to
=IF(D8>0,SUM($C$2:C3),"") for tons through June.

Maybe a better way of asking the question is:
Book1.xlsx
ABCDEF
1Current formuals for:
2Tons to Month Formulas in Column B and C to compare 21 to 22 Jan through April
3
4Year2122
5tons to month10,67610,368
6Jan2,5722,635
7Feb2,3522,327
8Mar2,8762,767
9Apr2,8772,638
10May2,6382,813
11Jun3,0623,117
12Jul3,121-
13Aug2,925-
14Sep2,747-
15Oct2,720-
16Nov2,784-
17Dec2,608-
18
19Looking for a formula that will allow me to populate a cell with the month that I want to compare the Tons to Month to
20MayExample: Popluate this cell(A20) with "May", and the formula in B23 and C23 changes to Sum the values in B24:B28, because B28 is the row that May is in.
21
22Year2122
23tons to month13,31513,182Note: B28 in the formula for Tons to Month would be based on the value "May" placed in cell B20
24Jan2,5722,635
25Feb2,3522,327
26Mar2,8762,767
27Apr2,8772,638
28May2,6382,813
29Jun3,0623,117
30Jul3,121-
31Aug2,925-
32Sep2,747-
33Oct2,720-
34Nov2,784-
35Dec2,608-
Sheet1
Cell Formulas
RangeFormula
B5:C5B5=SUM(B6:B9)
B23:C23B23=SUM(B24:B28)
 
Upvote 0
lonm How about this one? Now note the Data Validation in A20. This just makes sure you have the correct month spelling. Anyway let us know if you have any problems or questions.


22-07-18.xlsx
ABC
20May
21
22Year2122
23tons to month13314.847413181.7204
24Jan2572.10952635.42
25Feb2352.0012327.417
26Mar2875.60652767.4649
27Apr2876.6822638.071
28May2638.44842813.3475
29Jun3061.64133117.31
30Jul3121.47890
31Aug2924.7490
32Sep2746.71160
33Oct2719.5280
34Nov2784.14820
35Dec2607.5080
Data 2
Cell Formulas
RangeFormula
B23B23=SUM($B$24:INDEX($B$24:$B$35,MATCH($A$20,$A$24:$A$35,0)))
C23C23=SUM($C$24:INDEX($C$24:$C$35,MATCH($A$20,$A$24:$A$35,0)))
Cells with Data Validation
CellAllowCriteria
A20List=$A$24:$A$35
 
Upvote 0
Solution
Glad I could help. If you have any other problems or questions, let us know.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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