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:
30 possible shifts options. Starting M7 and finishing at AQ36. then depends on how many days the month have. 28,29,30 or 31 but the table is set on that M7 and AQ36 interval.

that was just an example sheet I'm trying so I dont mess up my original working sheet. when i get that to work I'll move it to the original sheet.

Maybe this will help you more. the original sheet:
m2yj9j

https://prnt.sc/m2yj9j

and this is the sample file just in case:
http://s000.tinyupload.com/index.php?file_id=04593569787061828058

Best regards,
eLy
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
An Example with 3 shifts

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

Formula in B7 copied down
Portuguese - BR
=SOMARPRODUTO(--(MATRIZ.MULT({1\1\1};--(C$2:J$4=A7))>0))

Note that the first array {1\1\1} has as many 1s as the number of shifts.

English
=SUMPRODUCT(--(MMULT({1,1,1},--(C$2:J$4=A7))>0))

M.
 
Upvote 0
Thank you, the problem was exactly the amount of \1 in there.

Seems to be working as expected.

best regards,
eLy
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,212
Members
449,074
Latest member
cancansova

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