Sumif

Davidns

Board Regular
Joined
May 20, 2011
Messages
143
Office Version
  1. 365
Platform
  1. Windows
How can i set a criterion to be equal to the day of a given month? In other words, the criteria range is filled with dates, and i need to sum those dates that have a particular day of the month.
Thanks!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
:eek: you may need to amend the formula if your regional settings are set to accept dates differently

To count the number of times 27 November 2018 appears in column A, use this
=COUNTIF(A:A,"=27/11/2018")

You mention SUMIF, which suggests requirement to sum values in another column for a single date

To sum the values in column B where the date in column A is 27 November 2018
=SUMIFS(B:B,A:A,"=27/11/2018")

To make the formula more flexible, use cells to hold the values for day (F2), month (G2) and year (H2)
=SUMIFS(B:B,A:A,"="&F2&"/"&G2&"/"&H2)

etc
 
Last edited:
Upvote 0
or use SUMPRODUCT

=SUMPRODUCT((DAY($A$2:$A$1000)=27)*(MONTH($A$2:$A$1000)=11)*(YEAR($A$2:$A$1000)=2018)*($B$2:$B$1000))

add flexibility (with day in F2, month in G2, year in H2)
=SUMPRODUCT((DAY($A$2:$A$1000)=$F$2)*(MONTH($A$2:$A$1000)=$G$2)*(YEAR($A$2:$A$1000)=$H$2)*($B$2:$B$1000))
 
Upvote 0
Thank you. Is there any way to set the criteria to match the specific day of the month (ie the 27th) without creating a new cell with days of the month? In other words, can you use a formula in the criteria cell incorporating the "day" formula? I didn't see a way, but maybe I am missing something.
Thanks
 
Upvote 0
can you use a formula in the criteria cell incorporating the "day" formula?
I must be misunderstanding something :confused:

Is that not what this does?
- it incorporates the DAY formula without using another cell for "day of the month"

=SUMPRODUCT((DAY($A$2:$A$1000)=27)*(MONTH($A$2:$A$1000)=11)*(YEAR($A$2:$A$1000)=2018)*($B$2:$B$1000))
 
Last edited:
Upvote 0
Hi,

I think may be OP means he just want to count the dates that are a particular day:


Book1
ABCDEF
111/27/201844Day Criteria27
21/27/2018
32/15/2018
46/27/2016
59/27/2015
Sheet335
Cell Formulas
RangeFormula
C1=SUMPRODUCT(--(DAY(A1:A5)=27))
D1=SUMPRODUCT(--(DAY(A1:A5)=F1))
 
Last edited:
Upvote 0
@jtakw - thanks :)

@Davidns
- is post#6 what you want?
- if not, please tabulate sample data and desired results to illustrate your requirements

thanks
 
Upvote 0
Thanks everyone. Looks like sumproduct is the way to go. I haven't used it before so will definitely learn more about it and start to use it.
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,285
Members
449,218
Latest member
Excel Master

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