Link to home
Start Free TrialLog in
Avatar of Bright01
Bright01Flag 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.
ASKER CERTIFIED SOLUTION
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

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.
Avatar of Bright01

ASKER

Rob,

Much thanks!  Works great!

B.
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.