Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Mgt
 
Posts: n/a
Default if...or....function

I need to create a function that says:

If cell x is either 2,4,6,or 8, then type 'blue' in cell y
and if cell x is either 1,3,5 or 7, then enter 'yellow' in cell y
and if cell x is either 10,12,14,or 16, then enter 'green' in cell y
etc....

  #2   Report Post  
Bob Umlas Excel MVP
 
Posts: n/a
Default

=IF(OR(x={2,4,6,8}),"BLUE",IF(OR(x={1,3,5,7}),"YEL LOW",IF
(OR(x={10,12,14,16}),"GREEN")))
where x is the cell containing the values, like:
=IF(OR(A1={2,4,6,8}),"BLUE",IF(OR(A1={1,3,5,7}),"Y ELLOW",IF
(OR(A1={10,12,14,16}),"GREEN")))


-----Original Message-----
I need to create a function that says:

If cell x is either 2,4,6,or 8, then type 'blue' in cell

y
and if cell x is either 1,3,5 or 7, then enter 'yellow'

in cell y
and if cell x is either 10,12,14,or 16, then

enter 'green' in cell y
etc....

.

  #3   Report Post  
Sandy Mann
 
Posts: n/a
Default

You dan't say what you want to do if cell x is other than the numbers that
you specify. Assuming that cell x will never be anything other than your
requirements then try:

=IF(A19,"Green",IF(MOD(A1,2)=1,"Yellow","Blue"))

HTH

Sandy

--
to e-mail direct replace @mailinator.com with @tiscali.co.uk


"Mgt" wrote in message
...
I need to create a function that says:

If cell x is either 2,4,6,or 8, then type 'blue' in cell y
and if cell x is either 1,3,5 or 7, then enter 'yellow' in cell y
and if cell x is either 10,12,14,or 16, then enter 'green' in cell y
etc....



  #4   Report Post  
Mgt
 
Posts: n/a
Default

thanks--this was the most helpful by far!
But I am still encountering problems after about 7 groups (are these called
arrays?)
Anyway I tried to do this and got a Value error:
=IF(OR(x={2,4,6,8}),"BLUE",IF(OR(x={1,3,5,7}),"YEL LOW",IF
(OR(x={10,12,14,16}),"GREEN",IF(OR(x={11,13,15,17} ),"RED",IF(OR(x={100,200,300,400}),"PINK",IF(OR(x= {500,600,700,800}),"black"))))))=IF(OR(x={45,55,65 ,75}),"BROWN...etc...i.e. group 3 groups of seven parenths, but not working...


"Bob Umlas Excel MVP" wrote:

=IF(OR(x={2,4,6,8}),"BLUE",IF(OR(x={1,3,5,7}),"YEL LOW",IF
(OR(x={10,12,14,16}),"GREEN")))
where x is the cell containing the values, like:
=IF(OR(A1={2,4,6,8}),"BLUE",IF(OR(A1={1,3,5,7}),"Y ELLOW",IF
(OR(A1={10,12,14,16}),"GREEN")))


-----Original Message-----
I need to create a function that says:

If cell x is either 2,4,6,or 8, then type 'blue' in cell

y
and if cell x is either 1,3,5 or 7, then enter 'yellow'

in cell y
and if cell x is either 10,12,14,or 16, then

enter 'green' in cell y
etc....

.


  #5   Report Post  
Harlan Grove
 
Posts: n/a
Default

Mgt wrote...
....
But I am still encountering problems after about 7 groups (are these
called arrays?)
Anyway I tried to do this and got a Value error:
=IF(OR(x={2,4,6,8}),"BLUE",IF(OR(x={1,3,5,7}),"YE LLOW",
IF(OR(x={10,12,14,16}),"GREEN",IF(OR(x={11,13,15, 17}),"RED",
IF(OR(x={100,200,300,400}),"PINK",IF(OR(x={500,60 0,700,800}),
"black"))))))=IF(OR(x={45,55,65,75}),"BROWN
...etc...i.e. group 3 groups of seven parenths, but not working...


Show the *ENTIRE* formula. What you've shown looks like a mistake at
the '=IF(' piece since it's unlikely you're really checking different
colors for equality against each other.

If you have lots of these groups of 4 values (more than 6), you'll
run out of nested function call levels. One work-around would be

=IF(OR(x={2,4,6,8}),"BLUE","")
&IF(OR(x={1,3,5,7}),"YELLOW","")
&IF(OR(x={10,12,14,16}),"GREEN","")
&IF(OR(x={11,13,15,17}),"RED","")
&IF(OR(x={100,200,300,400}),"PINK","")
&IF(OR(x={500,600,700,800}),"black","")
&IF(OR(x={45,55,65,75}),"BROWN","")
&...



  #6   Report Post  
Gord Dibben
 
Posts: n/a
Default

Mgt

You have run up against the 7 nested function limit in Excel.

For more on this see Chip Pearson's site.

http://www.cpearson.com/excel/nested.htm

Perhaps you could think about event code with Case Select.

Chip has info on that also.

http://www.cpearson.com/excel/events.htm


Gord Dibben Excel MVP


On Tue, 15 Mar 2005 15:25:04 -0800, Mgt wrote:

thanks--this was the most helpful by far!
But I am still encountering problems after about 7 groups (are these called
arrays?)
Anyway I tried to do this and got a Value error:
=IF(OR(x={2,4,6,8}),"BLUE",IF(OR(x={1,3,5,7}),"YE LLOW",IF
(OR(x={10,12,14,16}),"GREEN",IF(OR(x={11,13,15,17 }),"RED",IF(OR(x={100,200,300,400}),"PINK",IF(OR(x ={500,600,700,800}),"black"))))))=IF(OR(x={45,55,6 5,75}),"BROWN...etc...i.e. group 3 groups of seven parenths, but not working...


"Bob Umlas Excel MVP" wrote:

=IF(OR(x={2,4,6,8}),"BLUE",IF(OR(x={1,3,5,7}),"YEL LOW",IF
(OR(x={10,12,14,16}),"GREEN")))
where x is the cell containing the values, like:
=IF(OR(A1={2,4,6,8}),"BLUE",IF(OR(A1={1,3,5,7}),"Y ELLOW",IF
(OR(A1={10,12,14,16}),"GREEN")))


-----Original Message-----
I need to create a function that says:

If cell x is either 2,4,6,or 8, then type 'blue' in cell

y
and if cell x is either 1,3,5 or 7, then enter 'yellow'

in cell y
and if cell x is either 10,12,14,or 16, then

enter 'green' in cell y
etc....

.



  #7   Report Post  
Leo Heuser
 
Posts: n/a
Default

If the number of possibilities is the same for
each color (here 4 e.g. {1,3,5,7}), here's another
option:

=INDEX({"BLUE","YELLOW","GREEN","RED","PINK","BLAC K","BROWN"},
ROUNDUP(MATCH(x,{2,4,6,8,1,3,5,7,10,12,14,16,11,13 ,15,17,100,200,300,
400,500,600,700,800,45,55,65,75},0)/4,0))

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Mgt" skrev i en meddelelse
...
thanks--this was the most helpful by far!
But I am still encountering problems after about 7 groups (are these

called
arrays?)
Anyway I tried to do this and got a Value error:
=IF(OR(x={2,4,6,8}),"BLUE",IF(OR(x={1,3,5,7}),"YEL LOW",IF

(OR(x={10,12,14,16}),"GREEN",IF(OR(x={11,13,15,17} ),"RED",IF(OR(x={100,200,3
00,400}),"PINK",IF(OR(x={500,600,700,800}),"black" ))))))=IF(OR(x={45,55,65,7
5}),"BROWN...etc...i.e. group 3 groups of seven parenths, but not
working...





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
Hyperlinks using R[1]C[1] and offset function in its cell referenc Elijah-Dadda Excel Worksheet Functions 0 March 5th 05 03:31 AM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM
Trim function doesn't clean out ASCII Code 160 (Space) Ronald Dodge Excel Worksheet Functions 6 January 27th 05 03:48 AM
Formula to list unique values JaneC Excel Worksheet Functions 4 December 10th 04 12:25 AM
change function variable prompts?? thinkingfield Excel Worksheet Functions 1 November 8th 04 04:01 PM


All times are GMT +1. The time now is 10:11 PM.

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"