In cell A1 I have a number. I want a formula that looks at that number and then looks at row C on sheet2 where there are rows and rows of numbers. I want the formula to return the nearest match to the number in cell A1.
In cell A1 I have a number. I want a formula that looks at that number and then looks at row C on sheet2 where there are rows and rows of numbers. I want the formula to return the nearest match to the number in cell A1.
Hi ScabbyDog,
I suggest that you upload a sample spreadsheet with about 10-15 rows of data so we could figure our a solution for you.
If you like my answer please click on * Add Reputation
Don't forget to mark threads as "Solved" if your problem has been resolved
"Nothing is so firmly believed as what we least know."
--Michel de Montaigne
I thought it would be a simple enough index match forumla which I'm not very good at. The number in cell A1 would be for eg, 4.22 and in sheet 2 there would be the numbers 4, 4.5, 5 etc. So in this case I'd want the number 4 returned.
Attached is a sample workbook.
Thanks!SAMPLE1.xlsx
Try this
=LOOKUP(A1,Sheet2!$A$1:$A$40)
Hi,
Two options:
Array**:
=INDEX(Sheet2!$A$1:$A$40,MATCH(TRUE,ABS(Sheet2!$A$1:$A$40-A1)=MIN(ABS(Sheet2!$A$1:$A$40-A1)),0))
Non-array:
=INDEX(Sheet2!$A$1:$A$40,LOOKUP(16^16,1/(INDEX(ABS(Sheet2!$A$1:$A$40-A1),,)=MIN(INDEX(ABS(Sheet2!$A$1:$A$40-A1),,)))*(ROW(Sheet2!$A$1:$A$40)-MIN(ROW(Sheet2!$A$1:$A$40))+1)))
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
Last edited by XOR LX; 12-11-2013 at 10:39 AM.
you need to have two columns (A and C) in Sheet2: same numbers, column A sorted ascending, column C sorted descending.Please Login or Register to view this content.
In your example, using the above formula, you get 4.25 (4.25 is closed to 4.22 than 4)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks