Simplifying Formulas by Defining Names for Often-Repeated Parts

Problem:

The following formula searches column A for each of the serial numbers listed in column C.
It then analyses the corresponding number from column B: for numbers less than or equal to 40, 10 is added; and for numbers greater than or equal to 90, 10 is subtracted. Other numbers are returned as is.
=IF(VLOOKUP($C2,$A$2:$B$5,2,FALSE)>=90,VLOOKUP($C2,$A$2:$B$5,2,FALSE)-10,IF(VLOOKUP($C2,$A$2:$B$5,2,FALSE)<=40,VLOOKUP($C2,$A$2:$B$5,2,FALSE)+10,VLOOKUP($C2,$A$2:$B$5,2,FALSE)))
As can be seen, the underlined VLOOKUP part of the formula is repeated a number of times, thus creating a long and very complicated formula.
To make our spreadsheet easier to understand, we would like to simplify the formula.

Solution:

Step1: Define a name for the repeated part of the formula:
Select a cell > Insert > Name > Define > type the name “value” in the Names in workbooks text box > and enter the following formula in the Refers to box:
=VLOOKUP($C2,$A$2:$B$5,2,FALSE)
Step 2: Enter the following formula in cell D2, and copy it down the column:
=IF(value>=90,value-10,IF(value<=40,value+10,value))

Users are saying about us...

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Visit Us On TwitterVisit Us On FacebookVisit Us On Google PlusVisit Us On Youtube