ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   counting (https://www.excelbanter.com/excel-worksheet-functions/75227-counting.html)

chiapas77

counting
 

I need help in getting excel to count the number of different number
values in a specified range of cells across a row. example:
1 1 2 should return 2
0 1 2 should return 3
2 2 2 should return 0

Can anyone help? thanks.


--
chiapas77
------------------------------------------------------------------------
chiapas77's Profile: http://www.excelforum.com/member.php...o&userid=30568
View this thread: http://www.excelforum.com/showthread...hreadid=518894


Kevin Vaughn

counting
 
I took an array formula that I've seen used for getting unique numbers and
made a slight change to it so that if there was only one unique item, it
would return 0. Worked on your test data.

=IF(SUM(1/COUNTIF(A2:C2,A2:C2))=1,0,SUM(1/COUNTIF(A2:C2,A2:C2)))

Enter with cntl-shift-enter, not just enter.
--
Kevin Vaughn


"chiapas77" wrote:


I need help in getting excel to count the number of different number
values in a specified range of cells across a row. example:
1 1 2 should return 2
0 1 2 should return 3
2 2 2 should return 0

Can anyone help? thanks.


--
chiapas77
------------------------------------------------------------------------
chiapas77's Profile: http://www.excelforum.com/member.php...o&userid=30568
View this thread: http://www.excelforum.com/showthread...hreadid=518894



Ken Johnson

counting
 
Hi chiapas,
Please don't ask the same question on more than one forum.
People working on your problem are wasting their time if you have
already got the answer from another forum. Some of these people find
that very annoying.
Ken Johnson


Richard Buttrey

counting
 
On Fri, 3 Mar 2006 15:56:33 -0600, chiapas77
wrote:


I need help in getting excel to count the number of different number
values in a specified range of cells across a row. example:
1 1 2 should return 2
0 1 2 should return 3
2 2 2 should return 0

Can anyone help? thanks.


I don't quite understand why 2,2,2 should return 0. Logic suggests it
should perhaps be 1

From a suggestion by Bob Philips several months ago.

=SUMPRODUCT((A1:E1<"")/COUNTIF(A1:E1,A1:E1&""))

Just change the A:E range to cover the number of columns in your rows.

If you really want a 2,2,2 type row to show 0 rather than 1 then you
probably need to wrap it all in an If(Fn=1,0,Fn) construction.

HTH

Richard Buttrey
__

chiapas77

counting
 

I apologize for the double post... Thanks Kevin and Richard for your
help... actually you are right Richard... 2,2,2 would return 1 and it's
ok. This help really got me out of a jam.

saul.


--
chiapas77
------------------------------------------------------------------------
chiapas77's Profile: http://www.excelforum.com/member.php...o&userid=30568
View this thread: http://www.excelforum.com/showthread...hreadid=518894



All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com