Make Your Microsoft Dynamics Investment Count & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.
=IF(C10<VLOOKUP(B10,tbl,3,FALSE),"Minimum required "&VLOOKUP(B10,tbl,3,FALSE),IF(AND(C10>=VLOOKUP(B10,tbl,3,FALSE),C10<VLOOKUP(B10,tbl,5,FALSE)),VLOOKUP(B10,tbl,4,FALSE),IF(AND(C10>=VLOOKUP(B10,tbl,5,FALSE),C10<VLOOKUP(B10,tbl,7,FALSE)),VLOOKUP(B10,tbl,6,FALSE),IF(AND(C10>=VLOOKUP(B10,tbl,7,FALSE),C10<VLOOKUP(B10,tbl,9,FALSE)),VLOOKUP(B10,tbl,8,FALSE),VLOOKUP(B10,tbl,10,FALSE)))))
Public Function GetPrice(myItem As String, myQTY As Long) As Double
Dim myRange As Range
Set myRange = ThisWorkbook.Sheets("Sheet1").Range("A:k")
If myQTY >= Application.WorksheetFunction.VLookup(myItem, myRange, 9, False) Then
GetPrice = Application.WorksheetFunction.VLookup(myItem, myRange, 10, False)
ElseIf myQTY >= Application.WorksheetFunction.VLookup(myItem, myRange, 7, False) Then
GetPrice = Application.WorksheetFunction.VLookup(myItem, myRange, 8, False)
ElseIf myQTY >= Application.WorksheetFunction.VLookup(myItem, myRange, 5, False) Then
GetPrice = Application.WorksheetFunction.VLookup(myItem, myRange, 6, False)
ElseIf myQTY >= Application.WorksheetFunction.VLookup(myItem, myRange, 3, False) Then
GetPrice = Application.WorksheetFunction.VLookup(myItem, myRange, 4, False)
Else
MsgBox "Minimum order is " & Application.WorksheetFunction.VLookup(myItem, myRange, 3, False)
End If
End Function
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Tech Writing: Best way to indicate a screenshot is snipped? | 9 | 23 | |
Lync 2010 Certificate | 3 | 15 | |
Search for terms in Row 1, count the number of cleaned cells by means of a VBA Code | 4 | 26 | |
Array not populating all cells in Excel | 6 | 24 |
Join the community of 500,000 technology professionals and ask your questions.