• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 33
  • Last Modified:

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.
0
Bright01
Asked:
Bright01
  • 3
1 Solution
 
Rob HensonIT & Database AssistantCommented:
Simple lookup table will do this for you.

Setup a table like below, assume A1 to B5

0      Stage 1
21      Stage 2
41      Stage 3
61      Stage 4
81      Stage 5

Then a vlookup formula:

=VLOOKUP(C8,A1:B5,2)  where C8 is value being looked up.
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
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

0
 
Rob HensonIT & Database AssistantCommented:
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.
0
 
Bright01Author Commented:
Rob,

Much thanks!  Works great!

B.
0
 
Rob HensonIT & Database AssistantCommented:
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.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now