Formula for closest number

GerryZ

Well-known Member
Joined
Jul 4, 2014
Messages
1,224
Office Version
  1. 365
Platform
  1. Windows
Hello everybody
I need a formula in D2 that find th closest number (criteria number in D1)
esemple if in D1 is 9 should give me back 11 but if in D2 i digit 5 it should give me 4
thank yu for your help



Book1
ABCD
11CRITERIA6
24RESULT5
35
49
511
615
718
819
Foglio1
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi Gerry, if you enter 11 should it not return 11, as that is present in the list and is therefore the closest match?
 
Upvote 0
Hi Gaz!
right I don't need the same number of the criteria
es. in this case if i digit 11 it should give 9 becauose 9 is the closest number to 11
 
Upvote 0
If your numbers are sorted in ascending order, try
=VLOOKUP(D1-1,A1:A8,1)
 
Upvote 0
hello Gaz
Your formula is not correct because the formula founds only the closest number when is smaller of the criteria but i need also bigger of the criteria
es. criteria 18 it should return 19
thank you
 
Upvote 0
I can find nearest above or below, the problem is ignoring the value that is an actual match!
 
Upvote 0
What if your number in D1 is 5 and number in column will be

1
2
4
5
6

Then what is the number you need 4 or 6?
 
Upvote 0
@INGOLF
in this case both 4 and 6
 
Upvote 0
This finds nearest +/- but if an actual match it will return that!
Array - CSE

=INDEX(A1:A16,MATCH(MIN(ABS(A1:A16-D1)),ABS(A1:A16-D1),0))
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

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