Avatar of Bright01
Bright01
Flag for United States of America asked on

Looking for Formula that traps a result

EE Pros,

I'm looking for the formula that can trap a result and produce a specific text result.  In other words, if I have 5 stages, stage 1 is between 1 and 20, stage 2 is 21-40, stage 3 is 41-60, stage 4 is 61-80 and stage 5 is 81-100.  When the result, single number, falls within any of these ranges, the appropriate Stage is displayed.

That's it!

Appreciate your help in advance.

B.
Microsoft Excel

Avatar of undefined
Last Comment
Rob Henson

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rob Henson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Subodh Tiwari (Neeraj)

Or without making lookup table, you can try something like this....

Assuming the number being compared is in A2, then

=IF(AND(A2>0,A2<=100),"Stage "&MATCH(A2,{1,21,41,61,81}),"")

Open in new window

Rob Henson

Full syntax for VLOOKUP is

=VLOOKUP(LookupValue, LookupRange, Offset, LookupType)

LookupValue - the value being searched for,
LookupRange - the data in which it is being looked for with the lookup value in the leftmost column,
Offset - the column from which the result is required
LookupType - Options are True (or 1), False (or 0) or omitted. Choosing False will look for an exact match of the LookupValue, if not found it will return an error. Choosing True will look for the closest match that is not greater than the LookupValue and relies on the reference column being in ascending order. Omitting this parameter has the same effect as choosing True.
Bright01

ASKER
Rob,

Much thanks!  Works great!

B.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Rob Henson

Or also without Lookup table:

="Stage " &CEILING(C8,20)/20

CEILING will round a number up to a specified factor, in this case 20; dividing by 20 then gives the stage number.