Highlight/Select 'x' number of cells that average 'y'

Dual Showman

New Member
Joined
Feb 26, 2021
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
I need assistance with a formula or function that will select or highlight or otherwise distinguish 'X' number of cells in a range that, when averaged, equals 'Y'. I feel like there is a very clean way of accomplishing this, but my brain is cooked.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
This is actually a difficult problem. The number of combinations that has to be checked increases exponentially with the number of values. This gets very big very fast. My first attempt at this would be using Solver. How many total values do you have and what is a typical X? Do you have some sample data you can provide for testing? Another way would be to exhaustively test all combinations using VBA--again, very big.
 
Upvote 0
Thank you for your reply.

Yeah, I was trying to avoid VBA in order for it to be more user-serviceable once I'm not around to troubleshoot the non-Excel parts of the application, although VBA could solve all of this here given sufficient effort on my part. Too many irons in the fire. I'll look into Solver. No experience there.

To answer your question: Total values would ideally 100 plus, but let's say it's 40. X is typically 5 or 10. The sample data can be random numbers from -2 to 2.
 
Upvote 0
I can put together an example for you. What is Y?

-2 to 2 is a narrow range--are these real numbers or integers? If they are real numbers it complicates the problem due to real-number computer arithmetic.
 
Upvote 0
I can put together an example for you. What is Y?

-2 to 2 is a narrow range--are these real numbers or integers? If they are real numbers it complicates the problem due to real-number computer arithmetic.
They're real numbers, but for ease we can make it -200 to 200. Let's make Y = 2.
 
Upvote 0

Forum statistics

Threads
1,215,254
Messages
6,123,894
Members
449,132
Latest member
Rosie14

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