Formula Question

J

Joerolla

I have a range in column A (1-20), B1 = 5.2, How do I write formula so that C1 will give the closest answer to B1 from range in Column A?
 
P

Peo Sjoblom

Try

=VLOOKUP(ROUND(B1,0),A1:A20,1,0)

--

Regards,

Peo Sjoblom

Joerolla said:
I have a range in column A (1-20), B1 = 5.2, How do I write formula so
that C1 will give the closest answer to B1 from range in Column A?
 
V

Vasant Nanavati

Try:

=INDEX(A1:A20,MATCH(MIN(ABS(A1:A20-B1)),ABS(A1:A20-B1),0))

entered as an array formula with <Ctrl> <Shift> <Enter>.

--

Vasant

Joerolla said:
I have a range in column A (1-20), B1 = 5.2, How do I write formula so
that C1 will give the closest answer to B1 from range in Column A?
 
P

Peo Sjoblom

I assumed all values in A1:A20 were positive integers,
of course I probably mistook 1-20 as meaning just that
and not only A1:A20.
 
V

Vasant Nanavati

Hi Peo:

You could be right. I assumed it was rows 1-20 but on re-reading it's not
clear. Anyway, now the OP has 2 answers! <g>

Regards,

Vasant.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top