We often encounter product discounts in our shopping. Depending on the level of spending, the mall will offer different percentages of discounts. Usually, the more you spend, the bigger the discount, while the less you spend, the smaller the discount.
See the example below. Different discounts are offered depending on the amount of money spent.
With this table, we can calculate our discount based on our actual spending amount. Usually, the value provided in the consumption column is the starting line of the discount. For example, no discount if spending does not reach 1000, and if we spend more than $3,000 but less than $5,000, we can get a 15% discount.
In this example, we can use an Excel VLOOKUP function to create a formula to calculate a discount based on a given value. By entering different values, it should be possible to calculate the discount correctly.
Table of Contents
1. VLOOKUP FORMULA
In Excel, the VLOOKUP function returns a value at a specific location based on the location of the lookup value.
=VLOOKUP(lookup_value, table_array, column_index_num, [range_lookup])
So the formula is:
a. VLOOKUP Formula Explanation
In formula =VLOOKUP(D2,A2:B6,2)
In this example, output discount value is calculated based on the input value, which is stored in cell D2, so the lookup value is D2 (cell reference).
All values and discounts are in range A2:B6.
Discount is in the second column of this table, so column index number is 2.
Range lookup argument is optional. There are two modes “TRUE” (approximate match) and “FALSE” (exact match). If left blank, it goes into “TRUE” mode, VLOOKUP returns an approximate match. In this example, if we set “FLASE” in formula, we will get #N/A error because there is no “5600” in our table.
Convert cell reference and range reference in the formula bar to the actual value and array. The formula is:
As we mentioned above, Excel VLOOKUP runs an approximate match in this case. Since $5600 is above $5,000 but below $10,000, it does not reach the starting line of 20% discount, so it is assigned to the “$5,000 – 15% discount” level. Thus, a 15 percentage of discount is returned in cell E2, and the 15% is actually retrieved from the Discount column.
- Error #N/A returns by VLOOKUP if input value is lower than $1000.
- If we change the input value, this formula will calculate the discount accordingly.
b. VLOOKUP Formula Expand
We can calculate the discount price by simple addition, subtraction, multiplication and division.