Formula for SUM updates done Quarterly

ukanez

New Member
Joined
Dec 7, 2017
Messages
21
JanuaryFebruaryMarchQ1AprilMayJuneQ2JulyAugustSeptemberQ3OctoberNovemberDecemberQ4YTD
20202020202020202020202020202020202020202020202020202020202020202020
Apples
10​
10​
10​
30​
10​
10​
10​
30​
10​
10​
10​
30​
10​
10​
10​
30​
50​

Hey everyone. I'm trying to figure out a formula for the Q1-Q4 Columns that will dynamically sum based on the current date and quarter so that I have a correct YTD sum at the end.

Right now my YTD formula is SUM(B4:INDEX(B4:Q4,MATCH("current month",$B$1:$Q$1,0))). Originally I did not have quarter columns so this formula worked great for me because it would automatically update the YTD based on the month.

However now that I have these quarter columns I am getting a YTD sum that is double counting the quarter columns.

Example: It is currently May so YTD Apple sales should be 50. Instead however my YTD formula returns 80 which is 50 + 30 from Q1 column.

My attempt at fixing it: SUM(B4:INDEX(B4:Q4,MATCH("current month",$B$1:$Q$1,0)))-Sum(E4,I4,M4,Q4). However now I get 80 - 120 = -40 which is also incorrect. The Idea I am trying to figure out now is if there is a way to set Q1, Q2, Q3, and Q4 as dynamic sums that will only add up if the dates match. Example: Q2 will be 10 in April, 20 in May, and then 30 in June. Q3 will be 0 in June, 10 in July, 20 in August etc.

Sorry I hope this is clear, let me know if I need to explain further. I am not married to my current idea for a solution so if you have alternative, easier implementations that would work for me as well.

Thank you for your help.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Would using the SUBTOTAL function work for you?

Book1
ABCDEFGHIJKLMNOPQR
1JanuaryFebruaryMarchQ1AprilMayJuneQ2JulyAugustSeptemberQ3OctoberNovemberDecemberQ4YTD
220202020202020202020202020202020202020202020202020202020202020202020
3
4Apples10101030101010301010103010101030120
5Pears202015150035
Sheet3
Cell Formulas
RangeFormula
Q4:Q5, M4:M5, I4:I5, E4:E5Q4=SUBTOTAL(9,N4:P4)
R4:R5R4=SUBTOTAL(9,B4:Q4)
 
Upvote 0
Thanks, the SUBTOTAL function helps ignore the quarterly columns, but the problem I'm having is that the YTD column should be dynamic based on the current month. Is there anyway to fit SUBTOTAL into an INDEX MATCH formula so that the SUBTOTAL grabs a dynamic range based on the month?

Example: We're in May so the YTD for Apple sales should be 50 and not 120 which is the total YTD.
 
Upvote 0
Why would you have values in months above May? If no value in the months June - Dec. then SUBTOTAL should work.
 
Upvote 0
Try this in B3: =IF(LEFT(B1,1)="Q","",--(1&B1&B2)) and copy to the right.

In R4:

=SUMIFS(B4:Q4,$B$3:$Q$3,"<=" &TODAY())
 
Upvote 0
If there will be values past the current month and your headers are text and not dates formatted as month. Then try the formula in R4 for YTD.

Book1
ABCDEFGHIJKLMNOPQR
1JanuaryFebruaryMarchQ1AprilMayJuneQ2JulyAugustSeptemberQ3OctoberNovemberDecemberQ4YTD
220202020202020202020202020202020202020202020202020202020202020202020
3
4Apples1010103010101030101010301010103050
5Pears202015150035
Sheet3
Cell Formulas
RangeFormula
Q4:Q5, M4:M5, I4:I5, E4:E5Q4=SUBTOTAL(9,N4:P4)
R4:R5R4=SUBTOTAL(9,B4:INDEX(B4:Q4,0,MATCH(TEXT(TODAY(),"mmmm"),$B$1:$Q$1,0)))
 
Upvote 0
Hey sorry, yeah that's my fault. Technically this formula should be for 2019 where I have a full year of Apple sales.

The SUBTOTAL using an Index Match works perfectly. Thank you for the help!
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

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