View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default IF AND OR STATEMENT

I would add an extra worksheet that had the list of colors to ignore.

Then a formula like:

=iserror(match(a1,sheet2!a:a,0))
will return False if the color in A1 matches any cell in column A of sheet2.

FYI:
=isnumber(match(a1,sheet2!a:a,0))
would return true if there a match

So

=if(iserror(match(a1,sheet2!a:a,0)),b1*5,0)

or more simply:
=iserror(match(a1,sheet2!a:a,0))*b1*5

(excel will coerce the true to 1 and false to 0 when it does the multiplication.



Lea from CA wrote:

I want to multiply column B by 5 if Col A is not equal to Red or White or Blue.

Column A can have 100 distinct values and Red or White or Blue can be 20
different values or more.

I started with If(or(A1<"RED",A1<"BLUE",A1<"WHITE"),B1*5,0). I wanted
to know if there is any other way of creating the formula.

Col A Col B
Red 10
Orange 3
Green 4
Blue 8
White 5
Red 6
Purple 7
Gold 2
Blue 7
Pink 8
Yellow 6
Black 7
Brown 1


--

Dave Peterson