Same principle


Posted by Jon Swanson on February 13, 2002 3:55 PM

I need b2 to say level 1 if a1 is 1000 or less
say; level 2 if 1000 to 5000 or say level 3 if a1 is greater than 5000. The level(s) are text....Hope this makes sense.

Posted by Juan Pablo G. on February 13, 2002 4:28 PM

How about this ?

="Level " & (1 + (A1 > 1000) + (A1 > 5000))

Juan Pablo G.

Posted by anno on February 13, 2002 4:43 PM

i sit here, mouth agape. that's just brilliant. i was fiddling with something that was about a mile long and wasn't even sure it would work.[nt]

Posted by Russell Hauf on February 13, 2002 4:45 PM

Good one, Juan Pablo!

If the values of 1000, etc. are text, then you can modify to:

="Level " & (1 + (A1+0 > 1000) + (A1+0 > 5000))

-rh

Posted by anno on February 13, 2002 5:15 PM

hi russell
not challenging your modification - just a curious onlooker asking a question - but is it necessary? doesn't the existing "1+" already do the trick for text?
anno

Posted by Juan Pablo G. on February 13, 2002 5:20 PM

Just tested it, and Russel is right... I thought the same thing, but not. I.E. I put 1000 (as text) in A1, then in the formula i get this:

="Level " &(1+("1000">1000)+("1000">5000))

which translates to

="Level " &(1+TRUE+TRUE)

="Level " & 3

"Level 1" appears when A1 is empty.

Juan Pablo G.



Posted by anno on February 13, 2002 6:30 PM

yep, i get it. i had tested it too, before i asked the question of russell, but not with A1 empty. thanks for the explanation.