+ Reply to Thread
Results 1 to 8 of 8

Populate a list based on a single cell

  1. #1
    Registered User
    Join Date
    04-08-2014
    Location
    melbourne, australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Populate a list based on a single cell

    Hi, I am helping my son with the display of a quadratic in Excel. I won't go into detail about what he is required to do but essentially I would like to do the following:

    When I enter a value for 'Number of Steps' from a drop down a table is generated with the x values changing accordingly.

    For example:

    Number of Steps 5

    x x^2
    ------------
    0 0
    1 1
    2 4
    3 9
    4 16

    Number of Steps 9

    x x^2
    ------------
    0 0
    0.5 0.25
    1 1
    1.5 2.25
    2 4
    2.5 6.25
    3 9
    3.5 12.25
    4 16

    You will notice that the number of steps is the number of x values that take us up to 4. The 4 is fixed.
    I would be able to work out the maths myself as I am a maths teacher but I was wondering how I could autopopulate the table based on a drop down box selection. If it involves going into VBA then don't worry my son needs to get to grips with what I have done.

    Hope you can help.
    Regards,
    David.

    Edit. The formatting does not seem to work above.
    On the left of each table is supposed to be the x value and on the right is x^2.

    Edit: Thanks for the comment. Changed accordingly.
    Last edited by poppet; 04-08-2014 at 05:40 AM.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Populate a list based on a single cell

    Hi,

    You have only nine steps in your second example. Could you please clarify?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Populate a list based on a single cell

    Thanks.

    Assuming your number of steps is in D1:

    In A2 and copy down:

    =IF(ROWS($1:1)>$D$1,"",4/($D$1-1)*(ROWS($1:1)-1))

    In B2 and copy down:

    =IF(A2="","",A2^2)

    The examples you gave both resulted in the x values being integers for all steps. Obviously this wil not always be the case: however, you gave no indication of any rounding you would like to see, so none has been applied to these formulas.

    Note that you can also make the upper limit a variable by replacing the 4 in the first formula by a suitable cell reference.

    Regards

  4. #4
    Registered User
    Join Date
    04-08-2014
    Location
    melbourne, australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Populate a list based on a single cell

    Thank you. I'll take a look and drop you (the forum) a line.
    I just have to put kids to bed.

  5. #5
    Registered User
    Join Date
    04-08-2014
    Location
    melbourne, australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Populate a list based on a single cell

    Wow. That's amazing. Thank you.

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Populate a list based on a single cell

    You're welcome.

  7. #7
    Registered User
    Join Date
    04-08-2014
    Location
    melbourne, australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Populate a list based on a single cell

    Hi XOR LX,
    I know that it is asking a lot but I have another question.
    When I try to graph the quadratic the x axis values display incorrectly. For example if I fill your first formula down 30 rows and then select Number of Steps to be 10 say, the x axis values are displayed on the graph as simply integers 1,2,3 etc. even though they are displayed correctly in the table.

    If I the Number of steps is equal to the number of cells that I have filled with the formula the graph displays correctly.

    This has the effect of me having to insert a new graph each time and correctly selecting cells that only have values in them. This removes the dynamic feel of things.

    To sum up. If I ask excel to display a graph where the x coordinates do not have values in them it causes the x coordinates to be replaced with 1,2,3 etc. for the whole graph.

    Edit. I think I have solved this one. Rather than put "" in the empty cells I am now putting na() and the graph appears to cope with these well. Then I had #na in all of my cells but I painted them white and now you can't see them! This is called Whack a Mole isn't it?
    Last edited by poppet; 04-09-2014 at 12:32 AM.

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Populate a list based on a single cell

    Hey - let's just say that you're not alone in thinking that Excel's charting features aren't exactly top-of-the-range .

    Looks like you (somehow) hit upon a workaround, though, so well done!

    Cheers

+ 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. Auto Populate cell based on Drop Down list in another cell (VLookup)
    By alialmoore in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-27-2013, 04:07 PM
  2. Populate list from single click, add to list from additional clicks.
    By Pewpewpew in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-19-2013, 02:07 PM
  3. Save Multiple Files based on List AND Populate a Cell with value
    By aetedford in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-09-2013, 04:25 PM
  4. How to populate cell based on drop-down list attached to the SAME cell?
    By lpteague in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-25-2010, 02:01 PM
  5. Populate a cell based on input from a drop down list
    By TroyDurham in forum Excel General
    Replies: 9
    Last Post: 01-19-2009, 09:47 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