How to count only unique values from a column in a COUNTIFS

slam

Well-known Member
Joined
Sep 16, 2002
Messages
913
Office Version
  1. 365
  2. 2019
I have this formula so far:

Excel Formula:
=COUNTIFS(Raw!$B:$B,"11/22/2023  12:00:00 AM",Raw!S:S,A24,Raw!W:W,C23)

The problem is that my Raw worksheet has a lot of duplicates, and I only need to count one of each instance from column C on the Raw worksheet. Could someone please show me how to incorporate that into my formula?

Thanks!
 
Hi Fluff,

Can I use this somehow in place of a SUMIFS as well? Starting with my last formula above, can it be changed from a count to a sum of Raw!Y:Y ?

Thanks!
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Really not sure where the SUMIFS should go, and how to change the criteria to fit, or even if I need to. Also started playing around with HSTACK, but not sure if that is needed.

Slightly different criteria for this version:

Sad Attempt 1
Excel Formula:
=IFERROR(ROWS(UNIQUE(FILTER(Raw!$C:$C,SUMIFS(Raw!$Y:$Y,(Raw!$B:$B="11/22/2023  12:00:00 AM")*(Raw!$S:$S="Planned")*(Raw!$X:$X,="2025"))))),0)

Sad Attempt 2 (there were many more! :))
Excel Formula:
=IFERROR(ROWS(UNIQUE(FILTER(Raw!$C:$C,),SUMIFS(Raw!$Y:$Y,Raw!$B:$B,"11/22/2023  12:00:00 AM",Raw!$S:$S,"Planned",Raw!$X:$X,"2025"))),0)
 
Upvote 0
Why do you need to change the sumifs?
 
Upvote 0
Sorry, I'm not following. What do you mean by "change"?

It was working as a COUNTIFS, but now I need to use the same UNIQUE logic for a SUMIFS
 
Upvote 0
Gotcha.

It's because I only need to SUM each value in column Y:Y one time for each instance of the ID in column C.

So the data looks like this:

Col C | Col Y
ID1 | 100
ID1 | 100
ID1 | 100
ID2 | 700
ID2 | 700

In this case, the result I am looking for would be 800 (100+700)
 
Upvote 0
In that case just change ROWS to SUM & the filter range to the column that needs to be summed.
 
Upvote 0

Forum statistics

Threads
1,222,902
Messages
6,168,938
Members
452,227
Latest member
sam1121

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