You are here:

Excel/price with a range of quantity

Question
Hi,

The table below starts from A1 to C17

Item          Qty    Price1
Yoyo    1   12.00
Yoyo    20   15.00
Yoyo    40   40.00
Yoyo    50   60.00
Apple    1   10.00
Apple    15   15.00
Apple    20   18.00
Apple    25   21.00
Apple    40   24.00
Apple    50   27.00
Apple    100   40.00

Say, A20: Item, B20: Quantity

Can you please help me with a formula to determine an item with a specified quantity. For example, the price for Apple, Q=24 should be \$18; Apple, Q=40 should be \$24; etc.

Thanks again for your previous help.

Yu
Sydney

Yu,

I used this formula with your database (A1:C17) with the values you show for A20 and B20 to return the results you show.

Apple   24   returned 18
Apple   40   returned 24

=VLOOKUP(\$B20,OFFSET(\$A\$1,MATCH(\$A20,\$A\$1:\$A\$17,0)-1,1,COUNTIF(\$A\$1:\$A\$17,\$A20),2),2,TRUE)

Format the cell with the formula as currency if you want to see \$18.00 and \$24.00

if you wanted to put your lookup values to the right of your data, then you could change the formula to refer to all of column A

F20:  Apple
G20:  24

H20: =VLOOKUP(\$G20,OFFSET(\$A\$1,MATCH(\$F20,\$A:\$A,0)-1,1,COUNTIF(\$A:\$A,\$F20),2),2,TRUE)

--
Regards.
Tom Ogilvy

--
Regards,
Tom Ogilvy
Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Hi, Tom Many thanks again for a such an excellent and rapid answer to my question. Yu

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Tom Ogilvy

Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.