![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Join Date: Apr 2002
Posts: 2,314
|
Hi - I need a formula to look up a name and then find the nearest figure under the sales figure in the table - and bring back the data in the third column of the table.
i.e. in A1:C7 is the table, in A11 & B11 is the values to look up and C11 is the were I want the formula. Thanks. PS I know I'm crap at explaining this! ******** ******************** ************************************************************************>
[HtmlMaker 2.32] To see the formula in the cells just click on the cells hyperlink or click the Name box PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR. PPS. Have done it naming ranges and using vlookup & indirect - but it takes ages to name all the ranges! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
#2 |
|
MrExcel MVP
Join Date: May 2003
Posts: 8,445
|
Hi,
=INDEX($C$2:$C$7,MATCH(MIN(IF($A$2:$A$7=A11,ABS($B$2:$B$7-B11),"")),IF($A$2:$A$7=A11,ABS($B$2:$B$7-B11),""),0)) Array entered in C11. But 75 is equally close to 0 as to 150 is it not?
__________________
"Fair Winds and Following Seas" |
|
|
|
|
|
#3 |
|
Join Date: Apr 2002
Posts: 2,314
|
Sorry, it must have been the way I explained it (I said I was crap!)
If Steve S has a sale less than 150 then it should bring back 1% If Steve S has a sale more than or equal to 150 and less than 350 then it should bring back 2% If Steve S has a sale more than or equal to 350 then it should bring back 3% Same with John T but with different values. If I enter 76 in B11 it brings back 2% (should be 1%) I would have amended your formula if I could work it out! |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: California
Posts: 3,857
|
Try this
Code:
=SUMPRODUCT(($A$2:$A$7=A11)*($B$2:$B$7 |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 39,332
|
The second and third column of your lookup table are in ascending order. Is this accidental or deliberate? If the latter, why are the names in ascending order?
|
|
|
|
|
|
#6 | |
|
Join Date: Apr 2002
Posts: 2,314
|
Quote:
DRJ - Your formula works on the example but the Commissions in column C are only an example, they could be anything, I need the formula to look at the table - not do a calculation. Thanks. |
|
|
|
|
|
|
#7 |
|
Join Date: Apr 2002
Posts: 2,314
|
Bump
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: May 2003
Posts: 8,445
|
If i understand you correctly, the formula could be simpler.
=INDEX($C$2:$C$7,MATCH(B11,IF($A$2:$A$7=A11,$B$2:$B$7,""))) Still array entered in C11 Sales must be sorted ascending (within each name) ... and I don't agree with the last result for John T in the example you posted. Should be 1% I think.
__________________
"Fair Winds and Following Seas" |
|
|
|
|
|
#9 | |
|
Join Date: Apr 2002
Posts: 2,314
|
Quote:
The formula great, thanks. Your right, it should have been 1% |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|