#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default IF AND OR STATEMENT

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

  #2   Report Post  
Posted to microsoft.public.excel.misc
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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default IF AND OR STATEMENT

=B1*5*(A1<"Red")*(A1<"Blue")*(A1<"White")
OR
=5*B1*(1-(ISNUMBER(MATCH(A1,{"red","white","blue"},0))))
OR
=B1*5*ISNA(MATCH(A1,{"RED","WHITE","BLUE"},0))
In general, when you need conditional math it is not necessary to use IF
best wishes
--
Bernard Liengme
http://people.stfx.ca/bliengme
Microsoft Excel MVP

"Lea from CA" wrote in message
...
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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default IF AND OR STATEMENT

Your boolean is should be AND not OR. If A1 is not equat to Red and A1 is not
equal to White and A1 is not equal to Blue then... times 5. Another way would
be

If A1=Red, or A1= White or A1=Blue then nothing, else multiply by 5.
--
HTH...

Jim Thomlinson


"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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
If statement or lookup statement not sure Renegade40 Excel Worksheet Functions 2 January 18th 09 06:11 AM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM
Help please, IF statement/SUMIF statement Brad_A Excel Worksheet Functions 23 January 11th 05 02:24 PM


All times are GMT +1. The time now is 11:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"