how to get Nearest higher value

snjpverma

Well-known Member
Joined
Oct 2, 2008
Messages
1,584
Office Version
  1. 365
Platform
  1. Windows
the data in Column G is in ascending order and I want the number from Column G which is closest to the value in A2 as my return value.

the below lookup function gives me the closest lower value only. Please advise me how to get the closest higher value.

=LOOKUP(A2,G:G)
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hey snjpverma,

You could use an ARRAY formula
Code:
=INDEX(G:G,MATCH(MIN(ABS(G:G-A2)),ABS(G:G-A2),0))

Remember paste in the formula, and then hit CTRL+SHIFT+ENTER to create an array formula {}

Hope that helps
Caleeco
 
Upvote 0
Hi Caleeco,
I tried Your formula and it gives me the nearest lower value instead of the higher one
 
Upvote 0
I tried the below but it doesn't work either. it seems to work only in Descending order. but my data is in ascending.

=INDEX(G:G,MATCH(A2,G:G,-1))
 
Last edited:
Upvote 0
Hi,

Try this:

=INDEX(G:G,MATCH(A2,G:G,0)+1)
 
Upvote 0
Hi Caleeco,
I tried Your formula and it gives me the nearest lower value instead of the higher one

Strange. Works on my test sheet.

Do you want the Nearest value? or the Nearest-Highest Value?

Caleeco
 
Upvote 0
If it's possible that the value in A2 is not always an exact match for a value in G try:
Excel Workbook
ABCG
146
220423775
378
494
5102
6108
7167
8194
9237
10270
11308
12328
13330
14337
15383
16393
17404
18420
Sheet
 
Upvote 0
Try either of the following


Excel 2010
ABCD
2204237237
9b
Cell Formulas
RangeFormula
D2=AGGREGATE(15,6,1/($G$1:$G$18>A2)*$G$1:$G$18,1)
C2{=MIN(IF($G$1:$G$18>=$A2,$G$1:$G$18))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,407
Messages
6,119,332
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top