A VBA or Function That Could Separate a list of numbers to two different groups with close averages

jondavis1987

Active Member
Joined
Dec 31, 2015
Messages
443
Office Version
  1. 2019
Platform
  1. Windows
Below is a spreadsheet that I have. Specimen is A1. Density B1. The next specimen is D1. Density E1. Specimen G1. Density H1. So the specimen numbers will always stay the same in the same spot in column A. The density numbers in column B will change. The specimens get organized into two different groups that are supposed to average as close to each other as they can. So E7 averages E2:E4 and H7 averages H2:H4. Is there a way to use vba or a function to take the specimens and in A:B and sort them automatically into two different groups in E and H that would average as close as possible? I ask because the numbers in density are not always this close and it can take a while to find the right groupings.

SpecimenDensitySpecimenDensitySpecimenDensity
193.2193.2393.3
293.4293.4493.5
393.3693.3593.4
493.5
593.4AverageAverage
693.393.393.4
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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