Return closest data item to average in Excel

shawl

New Member
Joined
Feb 22, 2011
Messages
3
I have a list of data items in Excel and i want to find the item that is closest to the average (mean).

e.g.
If the list was

8
7
4
6
9

The average would be 6.8 so i would want the returned result to be 7.

I'm drawing a complete blank.

Thanks in advance.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
If those values are in A1:A5, place this in B1 and copy down:-
Code:
=ABS(AVERAGE(A$1:A$5)-A1)
Place this wherever you need the answer:-
Code:
=INDIRECT("A"&MATCH(MIN(B$1:B$5),B1:B5,FALSE))
 
Upvote 0
Thanks for your help

This worked when i did a small test but when i applied it to my data it failed to return the right result. I think this is because my data does not start at row 1, it starts at row 22 (K22:K275).

Is there a way to tweak it to take into account of the start of the range?

Thanks
 
Upvote 0
You could use this "array formula" to get the result all in one....

=INDEX(K22:K275,MATCH(MIN(ABS(K22:K275-AVERAGE(K22:K275))),ABS(K22:K275-AVERAGE(K22:K275)),0))

confirmed with CTRL+SHIFT+ENTER
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

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