# count by rows and columns, unique value only

#### tx12345

##### Board Regular
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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
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

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)

Sorry, my formula does not work.
It's counting wrong way.

Pekka

Formula in G2 is :

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

Thanks for the responses. The formulas are just what the doctor ordered for the overweight and out of shape spreadsheet

tx

Replies
5
Views
481
Replies
10
Views
951
Replies
11
Views
696
Replies
1
Views
574
Replies
8
Views
373

1,217,433
Messages
6,136,597
Members
450,021
Latest member
Jlopez0320

### 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.

### Which adblocker are you using?

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

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