Countif within range but ignore duplicates in row

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,404
Office Version
  1. 2016
Platform
  1. Windows
I need a formula that will count the amount of times a value appears in a range, ("A4:K5000"), but I need it to only count the value once if it appears more than once in each row.

As an example, if the value appeared 3 times in row 5 and once in row 6 then the result I would expect would be 2.

This formula does what I need but ignores duplicates in columns rather than rows - can it be tweaked?

Excel Formula:
[B]=SUMPRODUCT((A2:A15<>"")/COUNTIF(A2:A15,A2:A15&""))[/B]
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
You're formula does not match what you say you want.
Can you provide some sample data along with expected result.
 
Upvote 0
Sorry Fluff - here's a sample:

Input v6.xlsm
FGHIJK
420177 UNDKIN23975 KRBUSE25088 LORTAY
525604 LERBUT24312 YIBNNY
624312 YIBNNY25604 LERBUT24242 LYDOE22009 KERBA
725088 LORTAY3032 WOODER24242 LYDOE21015 TONCHAR
821015 TONCHAR22009 KERBA1190 PSTME
923975 KRBUSE3552 TNSKIG
10203 GALN203 GALN
1124273 LAIGE22643 LJONS3032 WOODER
1222009 KERBA25604 LERBUT
1324242 LYDOE24242 LYDOE
1420177 UNDKIN24242 LYDOE
1522643 LJONS24312 YIBNNY1190 PSTME3032 WOODER
163552 TNSKIG3032 WOODER24273 LAIGE
1722643 LJONS3032 WOODER24273 LAIGE2417 MBLU
1822643 LJONS2417 MBLU
1924273 LAIGE203 GALN
2024312 YIBNNY24273 LAIGE25604 LERBUT20354 TEEVDMC
2125088 LORTAY25088 LORTAY25604 LERBUT
2224242 LYDOE22643 LJONS25604 LERBUT
2321719 EECRESA25088 LORTAY
2425604 LERBUT3032 WOODER
2524312 YIBNNY23975 KRBUSE22009 KERBA
2620354 TEEVDMC3032 WOODER
2725604 LERBUT24312 YIBNNY3552 TNSKIG
2821719 EECRESA22009 KERBA20177 UNDKIN
2922009 KERBA203 GALN25604 LERBUT
3025088 LORTAY3032 WOODER25604 LERBUT
3120177 UNDKIN23975 KRBUSE
3222643 LJONS22643 LJONS
332833 DORFLO21719 EECRESA
3424273 LAIGE2833 DORFLO
3522009 KERBA3032 WOODER2417 MBLU
3623975 KRBUSE24273 LAIGE20354 TEEVDMC
CHECKS (2)


If I was looking for 203 GALN I would expect a result of 3 - it appears twice in row 10 but I only want it counted once per row.

Does this help?
 
Upvote 0
Ok, thanks for that, try
Excel Formula:
=SUMPRODUCT(--(MMULT(--(A4:K5000="203 galn"),ROW(1:11)^0)>0))
 
Upvote 0
Solution
You are a star - thanks Fluff, and Happy New Year!
 
Upvote 0
You're welcome & thanks for the feedback.

Happy New Year to you as well.
 
Upvote 0

Forum statistics

Threads
1,214,970
Messages
6,122,514
Members
449,088
Latest member
RandomExceller01

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