count values but exclude duplicates

elynoy

Board Regular
Joined
Oct 29, 2018
Messages
160
Office Version
  1. 365
  2. 2021
  3. 2016
Platform
  1. Windows
Hello, I need to count the number of times the letter C appears in a range of cells but i need to excelude the duplicate values out of that count.

Let me explain this better:

day1day2day3day4day5day6day7day8
08:0016:00aab
16:0024:00b

<tbody>
</tbody>

in this table the letter "A" shows 2 times on diferent columns, so the person worked 2 days. The letter "B" shows 2 times but I need it to count as one time so it shows as the person worked different shifts in that day.

so, if I have this:

day1day2day3day4day5day6day7day8
08:0016:00aabb
16:0024:00bb

<tbody>
</tbody>


I need the person as letter "B" to show as working 2 days (count it as 2 times) and not count the letter 4 times.

This is based on a COUNTIF formula.

If there a way to do this with a simple formula or vba?


Best regards,
eLy
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
day1day2day3day4day5day6day7day8day1day2day3day4day5day6day7day8
08:0016:00aabdcce08:0016:00aabdcce
16:0024:00:00bde16:0024:00:00
a helper table that blanks the lower of a pair of identical letters
then count the number of a,b,c,d,e
helper can be hidde

<colgroup><col span="2"><col><col><col><col><col><col><col><col><col span="4"><col><col><col><col><col span="2"><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Maybe...


A
B
C
D
E
F
G
H
I
J
1
day1​
day2​
day3​
day4​
day5​
day6​
day7​
day8​
2
08:00​
16:00​
a​
a​
b​
b​
3
16:00​
00:00​
b​
b​
4
5
Letter​
Result​
6
a​
2​
7
b​
2​
8

Formula in B6 copied down
=SUMPRODUCT(--(MMULT({1,1},--(C$2:J$3=A6))>0))

Hope this helps

M.
 
Upvote 0
Marcelo, can you add a sample? it seems to do exactly what I need but it gives me a #value error maybe because of language translation.
 
Upvote 0
I just noticed the value error is not translation. I searched but couldnt find any answer for it since it adds sumproduct and mmult.

I use excel 2010

Best regards,
eLy
 
Upvote 0
Excel 2010 Portuguese version

at the moment I'm using this formula but it works only if the letters are "separated"
Code:
=CONTAR.SE(F6:AI8;"A")

wich brings me to the problem of the same person working different shifts in the same day it will increas the countfor each shift.

best regards,
eLy
 
Upvote 0
None of them work. Can I add a sample for you to check?

eLy
 
Upvote 0
Excel 2010 Portuguese version

at the moment I'm using this formula but it works only if the letters are "separated"
Code:
=CONTAR.SE(F6:AI8;"A")

wich brings me to the problem of the same person working different shifts in the same day it will increas the countfor each shift.

best regards,
eLy

How many shifts? Two as in your original post or three (F6:AI8)?

M.
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,891
Members
449,194
Latest member
JayEggleton

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