[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Excel function



Hi Vinay,
Here's a quick and dirty solution (hopefully the text formatting looks ok):

Data1 Data2 Data 3 Pattern LookupVal Category
1            0            1         B                0            N/A
1            0            0         A                1               A
1            1            0         B                2               B
0            0            0         N/A            3              C
1            1            1         C           
0            1            0         A
0            1            1         B

Assuming the cell "Data1" is at 'A1' in the spreadsheet, the formula under "Pattern" is:

=VLOOKUP(COUNTIF(A2:C2,"<>0"),E$2:F$5,2)


This counts up the number of nonzero entries in each row and looks up what letter to assign it from the table at the right-hand side.


best,

-Owen.

---------------------------------
W. Owen Brimijoin
Investigator Scientist
MRC Institute of Hearing Research
Glasgow, United Kingdom
owen@xxxxxxxxxxxxx
---------------------------------