0

First of all, English is not my native language so explaining what I need is tricky.

So I have product that can have a range of widths. Depending on the width of the product, the aquisition price changes.

How can I make a cell where I input a width (in numbers), and depending on the range that that number is, another cell returns a certain price.

So let's say that the price for a product with widhts between 0-1000mm is 5 dollars. I want to introduce a product with a width of 500mm in a cell, and the next cell should output a price of 5 dollars.

And then let's say I want to add a product of 1300mm, and the price from 1000mm-2000mm is 10 dollars. So I would input 1300mm in a cell, and another cell should output 10 dollars.

Is that possible in excel? Please help!

2
  • Please have a look at this formula: =IF(A1<1000;5;IF(AND(A1 >=1000; A1<2000);10)) Commented Jun 19, 2023 at 8:46
  • 1
    Start with a table of prices. In each case, use just the lower boundary for the widths in the range, for example 0 > $5, 1001 > $10. Then you can use VLOOKUP or a similar function to easily return the price for any width using an inexact match (in VLOOKUP< set the last argument to True to do this). This is a text book example of using a lookup with inexact matching to find a value within a range and return a second value for it.
    – AdamV
    Commented Jun 19, 2023 at 12:17

2 Answers 2

0

As @AdamV said.....

  1. Create a table of your price list.
    The Max column isn't needed, but helps you keep an eye on the range.
    Price List

  2. Select a cell within the table and press Ctrl+T to turn it into an Excel table.
    Note that the Table Design ribbon will appear and you can rename the table.
    Price List as a table

  3. Use either formula:
    =XLOOKUP($H$2,Table1[Min],Table1[Price],,-1) or
    =VLOOKUP(H2,Table1,3,TRUE)
    enter image description here

The -1 in XLOOKUP and TRUE in VLOOKUP is "exact match, if none found return the next smaller item".

You could also keep the data as just a range of cells, but the formula won't automatically extend as you enter new price ranges.

Edit: You could also use =INDEX(Table1[Price],MATCH(H2,Table1[Min],1))

0

New here - but wanted to add something that could be helpful. In the newer versions of excel there is an IFS function. This function was created so you don’t have to nest IF functions like have been proposed as solutions here. IFS function allow you to evaluate a series of IF functions.

I’ll give it a go now but please take reference YouTube to verify.

=IFS(A8<1000,5),(A8>1000&A8<2000,10),(IF logic #3))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .