Sum with criteria

Tikey

Board Regular
Joined
Jan 30, 2014
Messages
148
Office Version
  1. 2021
Platform
  1. Windows
Hi

I have a column of dates which cover several years in the format 01/01/2018, this column is modified with dates added to and removed regularly. I wish to be able to search for a particular year and then sum all the unique dates in that year without counting the same date twice and also only counting dates where col B >0.

Col A Col B

01/01/2018 1
01/01/2018 0
02/01/2018 1
02/01/2018 2
02/01/2018 0
03/01/2018 0
01/05/2016 1
03/05/2016 2

So if I were to search the above for unique days in 2018, with dates where col B is >0, the answer would be 2.

Any help appreciated, thank you.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
try something like sumifs
=sumifs(B;B,A:A,">="&"select a date with the year you want",A:A,"<="&eomonth(select date you want,0))
 
Upvote 0
sorry I did it for a month you want a date
do
sumifs(B:B,A:A,">"&select a date that is one day less than what you want,A:A,"<"&select a day greater tan what you want
you might need to put 2 dates I cells
 
Upvote 0
I have tried editing your formula to =sumifs(B;B,A:A,">="&"01/01/2018",A:A,"<="&31/12/2018,0)) without success. I am wishing to search for a year and count the unique dates within the year where the other column has a value >0.

Apologies if you have had several responses I am having problems replying.
 
Upvote 0
Hi

D1=SUM(IF(FREQUENCY(IF(YEAR(A1:A100)=2018,IF(B1:B100>0,IF(A1:A100<>"",A1:A100))),A1:A100),1)) control+shift +enter
 
Upvote 0
That works great, thanks very much. Top man.
 
Upvote 0

Forum statistics

Threads
1,214,874
Messages
6,122,036
Members
449,062
Latest member
mike575

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