[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
Solved

# Excel formula to return the lowest, closest number to another?

Posted on 2013-02-02
Medium Priority
383 Views
I have a column of numbers between 1 and 5,000, in cells A1:A100

How do I write an Excel formula that returns the lowest, closest number to the number 1,000?

(For example, if the closest numbers to 1,000 are the numbers 900 and 1,100 -- it should return the number 900.)

Thanks.
0
Question by:Tim Jackoboice
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2
• 2

LVL 24

Expert Comment

ID: 38847446
The formula below should do the job:

=SMALL(A1:A100,COUNTIF(A1:A100,"<=1000"))
0

Author Comment

ID: 38847472
What happens in the event all my numbers are ABOVE 1,000? It doesn't seem to work. Thx.
0

LVL 24

Expert Comment

ID: 38847487
The following will return "ALL GREATER" if there is not a number lower than  the chosen:
=IFERROR(SMALL(A1:A100,COUNTIF(A1:A100,"<=1000")),"ALL GREATER")
You can swap the "ALL GREATER" for whatever reponse suits.
0

LVL 50

Accepted Solution

barry houdini earned 2000 total points
ID: 38847607
>How do I write an Excel formula that returns the lowest, closest number to the number 1,000?

Try this formula

=MIN(IF(ABS(A1:A100-1000)=MIN(ABS(A1:A100-1000)),A1:A100))

confirmed with CTRL+SHIFT+ENTER

If you have 999 and 1001 in the list the formula returns 999

regards, barry
0

Author Closing Comment

ID: 38847625
Hi Barry: Perfect. That works. Thanks to you, too, Barman, but I couldn't use a text filler.

Barry, would you mind taking a look at my other question, "Excel: Formula to Return an Answer Closest to a Target", too?

Seems like we were getting close and then the answers dropped off. Thanks!
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
###### Suggested Courses
Course of the Month14 days, 7 hours left to enroll