View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Lars-Åke Aspelin[_2_] Lars-Åke Aspelin[_2_] is offline
external usenet poster
 
Posts: 913
Default A complex formula, help needed

On Sat, 12 Dec 2009 02:10:02 -0800, Mac
wrote:

Hello all,
please help me with a complex formula to assign to a cell; pseudocode for it
goes like: for (i = 1 to 6 ; i++){ if (( Ai == value1) AND (Di == value1))
then (for( j = 7 to 25){ if (Bj == value2) then (write XX into this cell)}
)}; although it is an obvious candidate for vba, I wonder if the procedure
can be realized via cell formulae...


Don't know if I understood you pseudocode correctly, but try this

=IF(AND(AND(A1:A6=1,D1:D6=value1),AND(B7:B25=value 2)),XX)

Note: This is an array formula that has to be confirmed with
CTRL+SHIFT+ENTER rather than just ENTER.

Replace value1, value2 and XX with the values you want to use.

The result of the formula is XX if all of A1:A6 ans D1:D6 have the
value1 at the same time as all of B7:B25 has the value2.
Other wise the result is FALSE.

Hope this helps. / Lars-Åke