+ Reply to Thread
Results 1 to 8 of 8

How to Generate a Range of Values between 2 Points with a Given Average

  1. #1
    Registered User
    Join Date
    06-20-2016
    Location
    Houston
    MS-Off Ver
    2010
    Posts
    73

    How to Generate a Range of Values between 2 Points with a Given Average

    So, I'm trying to figure out a way for excel to generate a range of values (given the amount of values/points you want to have) scattered relatively evenly (if you were to view it visually plotted on a linear graph) between a high & low value or range, with a given average (meaning the average is set beforehand, and the entire list of values will end up averaging out to that number).

    So for instance, say you have:
    - High End: 100
    - Low End: 10
    - Average: 70
    - Number of data points: 5

    This means that there will be 5 values total (that need to be scattered relatively evenly) between 10 and 100, to where they will average out to 70. So the results may look like this:
    1) 85
    2) 77.5
    3) 70
    4) 62.5
    5) 55

    This is just a rough example, and it may not end up with those exact values. But I hope it gives the idea of what I'm looking for.

    I have attached a workbook with a similar scenario with different values. Each of the 4 conditions I listed above are variable and will change when the scenario changes, but once they are all entered, I need excel to calculate each of the points/values in the way described. Is there any possible way to do this in excel?

    Thank you for your help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: How to Generate a Range of Values between 2 Points with a Given Average

    use f9 to recalculate.
    Attached Files Attached Files
    Last edited by bsalv; 11-07-2021 at 12:40 AM.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,434

    Re: How to Generate a Range of Values between 2 Points with a Given Average

    Sorry for off-topic interjection:

    @bsalv

    Although there is no official rule regarding this behaviour, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

    I'm sure you understand, and we look forward to seeing you post your formulas/macros in your posts for the searching benefit of all.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: How to Generate a Range of Values between 2 Points with a Given Average

    it was sunday 5 am, afterwards I went back to bed.

    So it was a simple use of the "forecast"-function
    with 1st (x,y)= ((max points +1)/2, average)
    and 2nd (x,y) = (1,Y) or (last point,Y) with Y a random value between that minimum or maximimumvalue and the average.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,434

    Re: How to Generate a Range of Values between 2 Points with a Given Average

    Please post the formula itself in your post. Thanks.

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: How to Generate a Range of Values between 2 Points with a Given Average

    Here is a formula that will provide the maximum possible span between the first and last outputted values while providing exact (within Excel's rounding capabilities) differences between steps and while also averaging to exactly (again, within Excel's rounding capabilities) the value you specified as the average. Put this formula in cell C9 and copy it down for as many rows as you think you will ever have steps for...
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: How to Generate a Range of Values between 2 Points with a Given Average

    Please Login or Register  to view this content.
    steps are rounded to 0.01, even with an even number of points
    Attached Files Attached Files
    Last edited by bsalv; 11-07-2021 at 06:34 AM.

  8. #8
    Registered User
    Join Date
    06-20-2016
    Location
    Houston
    MS-Off Ver
    2010
    Posts
    73

    Re: How to Generate a Range of Values between 2 Points with a Given Average

    Hey Bsalv, thank you for what you provided for me. That is a great solution when I need it to do this at with some randomness thrown in. And it is done in a way that I was not expecting. Thank you so much.

    Rick Rothstein -- thank you also. You helped make it so that the points were spread out as much as they could be, and as evenly as they could be. This is what I was thinking, and I think both your solution and Bsalv's will be useful for what I'm trying to do. Thank you both for all your help!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Generate a range of values between specific dates
    By cameronw87 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2021, 11:32 AM
  2. [SOLVED] Average if values in adjacent columns is >0 AND adjust the average range each time
    By ew17 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2020, 12:56 PM
  3. Awarding points based on a range of values
    By robbielaybourn in forum Excel General
    Replies: 4
    Last Post: 07-09-2018, 09:23 AM
  4. [SOLVED] Generate internal grid points from 4 corner points
    By kersplash in forum Excel General
    Replies: 11
    Last Post: 02-20-2018, 03:00 PM
  5. Generate test data from range of values using vba
    By karthik82vk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2014, 03:22 AM
  6. Allocating points to values within given cell range?
    By Paul Bentham in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-27-2008, 02:32 PM
  7. [SOLVED] How do I generate a list from a range of values
    By robo7084 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-05-2006, 08:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1