View Single Post
  #11   Report Post  
Harlan Grove
 
Posts: n/a
Default

Jerry W. Lewis wrote..
The OP's application was an entire column as the second argument.
COUNTIF will not work for that.

....

Not in my reading. To repeat,

What type of formula would respond to the following conditions 12

(excel
seems to only permit up to 7...is it possible to get around that?):

IF Any Cell in Column AA= A1 and Any Cell in Column AB =B1 then C1=555
IF Any Cell in Column AA= A2 and Any Cell Column AB =B1 then C1=666
IF Any Cell in Column AA= A3 and Any Cell Column AB =B1 then C1=777

IF Any Cell in Column AA= A1 and Any Cell in Column AB =B2 then C1=888
IF Any Cell in Column AA= A2 and Any Cell in Column AB =B2 then C1=999
IF Any Cell in Column AA= A3 and Any Cell Column AB =B2 then C1=000

IF Any Cell in Column AA= A1 and Any Cell in Column AB =B3 then C1=111
IF Any Cell in Column AA= A2 and Any Cell in Column AB =B3 then C1=222
IF Any Cell in Column AA= A3 and Any Cell Column AB =B3 then C1=333

IF Any Cell in Column AA= A1 and Any Cell in Column AB =B4 then

C1=1212
IF Any Cell in Column AA= A2 and Any Cell in Column AB =B4 then

C1=2323
IF Any Cell in Column AA= A3 and Any Cell Column AB =B4 then C1=4545


I'd rephrase this as if any cell in col AB = value of cell B1, then set
cell C1 to a value based on which of the values of A1:A3 appear in col
AA. If no col AB match for B1, then try B2, B3, B4, etc.

It'd be a stretch to interpret this as the OP wanting to check all
cells in col B. Possible, perhaps, but unlikely. Or perhaps the OP
multiposted in another thread or ng, and you're referring to that.

Anyway, the point here is that the col AA - C1 value is a lookup, if a
complicated one, and col AB and cells in col B determine the lookup
results.

C1 [array formula]:
=INDEX({555,666,777;888,999,0;111,222,333;1212,232 3,4545},
MATCH(TRUE,COUNTIF($AB:$AB,B1:B4)0,0),
MATCH(TRUE,COUNTIF($AA:$AA,A1:A3)0,0))

It'd be better to use a range to store the return values for cell C1,
but the main point is that this can be done in a *SINGLE* formula, and
the matrix of return values can grow way beyond just 12 choices.
Indeed, this begs the question whether the ideal data structure would
be having A1:A3 in A2:A4 instead, B1:B4 in B1:E1 instead, and the
return values as above in B2:E4, making this a more obvious 2D lookup.