count by rows and columns, unique value only

tx12345

Board Regular
Joined
Aug 28, 2006
Messages
165
Hi

i think this is an easy one, but not so easy for me.

is it possible to count a value in each column per row of the range , and then move on to the next row looking for the same?

for example:

Code:
target number: 123 

123 456 345 <-- 123 shows here
123 445 271 <-- 123 shows here
445 445 255 
636 636 300
300 123 123 <-- 123 shows here

so we have three columns wide and 5 rows deep. 123 appears in 3 of the rows (what i want to find) although it appears within the entire range a total of 4 times.

TIA!

tx
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Pekkavee

Well-known Member
Joined
May 25, 2004
Messages
1,218
Try this formula
I turned it from Finnish language into English formula, so I hope it's right.

Code:
=IF(SUMPRODUCT(--(A1:A5=A9))=0,0,1)+IF(SUMPRODUCT(--(B5:B5=A9))=0,0,1)+IF(SUMPRODUCT(--(C1:C5=A9))=0,0,1)

In A9 I have 123

Regards
Pekka
:eek: :eek: :eek:
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
Hi

i think this is an easy one, but not so easy for me.

is it possible to count a value in each column per row of the range , and then move on to the next row looking for the same?

for example:

Code:
target number: 123 

123 456 345<-- 123 shows here
123 445 271<-- 123 shows here
445 445 255 
636 636 300
300 123 123<-- 123 shows here

so we have three columns wide and 5 rows deep. 123 appears in 3 of the rows (what i want to find) although it appears within the entire range a total of 4 times.

TIA!

tx
Book5
ABCDEFG
1targetcount
21234563451233
31234452714452
4445445255
5636636300
6300123123
7
Sheet1


G2, copied down:

=SUMPRODUCT((MMULT(($A$2:$C$6=F2)+0,ROW($A$2:INDEX($A$2:$A$6,COLUMNS($A$2:$C$6)))^0)>0)+0)
 

bosco_yip

Well-known Member
Joined
Dec 2, 2002
Messages
1,938
Office Version
  1. 2019
Platform
  1. Windows
Formula in G2 is :

=SUM(--(MMULT(COUNTIF(F2,A$2:C$6),{1;1;1})>0))
 

tx12345

Board Regular
Joined
Aug 28, 2006
Messages
165
Thanks for the responses. The formulas are just what the doctor ordered for the overweight and out of shape spreadsheet

tx
 

Forum statistics

Threads
1,141,626
Messages
5,707,483
Members
421,510
Latest member
haroonstr

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
Top