Sum values of the last "N" number of days

anwaee2

Board Regular
Joined
Sep 13, 2012
Messages
151
Office Version
  1. 2011
Platform
  1. MacOS
I have dates in the range A8:A250 with values in range B8:B250. What I would like to be able to do is sum the values that fall in the last "N" number of calendar days. The dates are in order from earliest down the column to lastest. Every day is not entered so the sum may be for only 5 days total because those were the only dates that fall in the last "N" number of days and have value. Is this posible with a formula not using VBA? I tried the ones below with no results. U42 is the "N" number.

=SUMIF(A8:A250,">= MAX(A8:A250)-U42+1",B8:B250)

=SUMIF(A8:A250,">= A2",B8:B250) and putting = MAX(A8:A250)-U42+1 in cell A2

=SUMIFS(B8:B250,A8:A250,">= MAX(A8:A250)-U42+1")

=SUMIFS(B8:B250,A8:A250,">= A2") and putting = MAX(A8:A250)-U42+1 in cell A2
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi,

You just have misplaced quote marks in your formula, should be:

Excel Formula:
=SUMIF(A8:A250,">="&MAX(A8:A250)-U42+1,B8:B250)
 
Upvote 0
Solution
Thank you they both work great, I feel a little silly with my mistake. Even they both work, I will use jtakw's version as I need to know from the last date entered not from today. Thanks again for the quick response and thank you Mr. Excel forum for all the answers to my questions in the past too.
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0
Greetings, I am brand new to the group.

I am trying to get four different SUMS for date rages. I have =TODAY() as the base and the four dates established off of TODAY.
Today-30 Days-90 days-180 Days-360 Days
2/3/2022​
1/4/2022​
11/5/2021​
8/7/2021​
2/8/2021​

Now I am looking at pulling the SUMS for each range from a single column.

Thank you for any suggestions.
--Milton
 
Upvote 0

Forum statistics

Threads
1,214,992
Messages
6,122,631
Members
449,095
Latest member
bsb1122

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