View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default I am having trouble with the IF function and a compound condition

One way:
=IF(AND(OR(A100={369,391}),B100="Gas"),54,18)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"rub" wrote:
I want to use the IF function to set a value of 54 if A100=369 and
B100="Gas" or A100=391 and B100="Gas". Otherwise the value should be
18.

I used =IF((A100=369 and B100="Gas") or (A100=391 and
B100="Gas"),54,18) and got an error.

I also used =IF(B100="Gas" and (A100=369 or A100=391), 54,18) and also
got an error.

Any ideas?