Solved

Looking for Formula that traps a result

Posted on 2016-07-29
5
25 Views
Last Modified: 2016-07-29
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
Comment
Question by:Bright01
  • 3
5 Comments
 
LVL 33

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 41734558
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
 
LVL 30

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41734567
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
 
LVL 33

Expert Comment

by:Rob Henson
ID: 41734568
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
 

Author Closing Comment

by:Bright01
ID: 41734572
Rob,

Much thanks!  Works great!

B.
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 41734573
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question