(Note: I also posted this on Excel / General questions. I hope I'm not
violating a rule by double-posting.)
I've got a table A2:Z100, with X's in some of the cells. A row may have one
or multiple Xs. I'm trying to find the number of rows which are "pureplays",
which is defined as a row with only one X.
For each column, I'd like to count the number of pureplays for that column
only, and put that value in the top row. So, for example, C1 would count the
number rows that have contain one X only and that X is in column C.
(I can't figure out how to do it with COUNTIF. A formula
COUNTIF(C2:C100,"X") will count the number of Xs in column C, but it's not
limited to the rows containing only one X.)
Any ideas??
Thanks.
Barb Reinhardt - 16 Oct 2006 17:40 GMT
This looks like a sumproduct question to me, but I'm not sure it can handle
26 different conditions.
=SUMPRODUCT(--(A1:A100="X"),--(B1:B100="X"),--(C1:C100="X")) would give you
the number of rows that only have X in them in columns A-C.
> (Note: I also posted this on Excel / General questions. I hope I'm not
> violating a rule by double-posting.)
[quoted text clipped - 14 lines]
>
> Thanks.
Dave F - 16 Oct 2006 17:42 GMT
Just do: =IF(COUNTIF([range],"X")=1,"only one X","other")
Dave

Signature
Brevity is the soul of wit.
> This looks like a sumproduct question to me, but I'm not sure it can handle
> 26 different conditions.
[quoted text clipped - 20 lines]
> >
> > Thanks.
Roger Govier - 16 Oct 2006 18:11 GMT
Hi Eric
You could do it with two additional columns AA and AB
in AA2
=IF(COUNTIF(A2:Z2,"X")=1,1,"")
in AB2
=IF(AA2=1,CHAR(MATCH("x",A2:Z2)+64),"")
Copy AA2:AB2 through AA3;AA100
You will now have a column of data where the column letter containing
only a single X in the row is shown.

Signature
Regards
Roger Govier
> (Note: I also posted this on Excel / General questions. I hope I'm
> not
[quoted text clipped - 20 lines]
>
> Thanks.
PapaDos - 16 Oct 2006 21:31 GMT
Try this for column A:
=SUMPRODUCT( ( A$2:A$100 = "x" ) * ( COUNTIF( OFFSET( $A$2:$Z$2, ROW(
A$2:A$100 ) - 2, 0 ), "x" ) = 1 ) )
Drag-fill as needed.

Signature
Regards,
Luc.
"Festina Lente"
> (Note: I also posted this on Excel / General questions. I hope I'm not
> violating a rule by double-posting.)
[quoted text clipped - 14 lines]
>
> Thanks.
Roger Govier - 16 Oct 2006 22:46 GMT
Very nice Luc!

Signature
Regards
Roger Govier
> Try this for column A:
>
[quoted text clipped - 27 lines]
>>
>> Thanks.
Eric - 17 Oct 2006 01:35 GMT
Thanks. Clever. I didn't know that a logical value works as a 0/1 in
multiplication.
Although I'm new to SUMPRODUCT, I think that your formula needs a little
adjustment. Either replace the asterisk with a comma (to separate the two
arguments of SUMPRODUCT), or use simply SUM instead. Does that seem right to
you?
Thanks for your help.
> Try this for column A:
>
[quoted text clipped - 21 lines]
> >
> > Thanks.
PapaDos - 17 Oct 2006 02:25 GMT
No.
But don't take my word for it, try and play with your ideas/solutions...
There is more than one way to do this, using SUMPRODUCT, SUM, COUNT, etc.

Signature
Regards,
Luc.
"Festina Lente"
> Thanks. Clever. I didn't know that a logical value works as a 0/1 in
> multiplication.
[quoted text clipped - 31 lines]
> > >
> > > Thanks.