+ Reply to Thread
Results 1 to 4 of 4

How to create a range of numbers based on quantity: I'm desperate

  1. #1
    Registered User
    Join Date
    05-12-2021
    Location
    Cologne
    MS-Off Ver
    MS Office 365
    Posts
    2

    How to create a range of numbers based on quantity: I'm desperate

    I have a dataset containing the age (a) and the number (#) of people with that age in one column each. The set looks like this:

    a | #
    1 | 2
    2 | 3
    3 | 0
    4 | 1

    Now, there are all sorts of inelegant ways to transform the above table into a list where the respective age appears #-times, like so:

    1 (=A1)
    1
    2
    2
    2
    4 (=A6)

    I don't have space for such a solution. Instead, I'm looking for a function, which directly applies to the two-column-table above, and which gives me a value that is equivalent to the range A1:A6 from the list. Such a function would make my life much easier, not least of all because I'd finally be able to avoid this stupid SUMPRODUCT function to calculate the average ages.

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: How to create a range of numbers based on quantity: I'm desperate

    If you're actually using Office 365, you should be able to use spilled formulas. If the a|# data were in E1:F4, and if everything in E1:E4 were a single character,

    A1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    If the values in column E could be varying numbers of characters, it's more complicated.

    A1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-12-2021
    Location
    Cologne
    MS-Off Ver
    MS Office 365
    Posts
    2

    Re: How to create a range of numbers based on quantity: I'm desperate

    FANTASTIC!

    The second solution is exactly what I was looking for and there was absolutely now way that I would have figured it out myself. Many thanks!

  4. #4
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: How to create a range of numbers based on quantity: I'm desperate

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    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.

+ 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. [SOLVED] Highlight cell based on total quantity value based on repeated order numbers
    By PWilson0727 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2014, 02:02 PM
  2. Create range of numbers on one row from incrementing numbers on multiple rows
    By mexykanu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-20-2014, 04:40 PM
  3. Desperate for VBA code to auto sort a column that contains numbers and text
    By speople in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-13-2014, 08:53 PM
  4. [SOLVED] Automatically create and fill rows based on a given quantity
    By Bax in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2013, 09:49 AM
  5. Desperate Help Needed for an Easy Cheat to Create New Sheets with Formulas!!
    By NatTia123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-15-2013, 10:42 AM
  6. [SOLVED] Desperate Help needed with Locking out a range of cells based on selection from 1 cell
    By Vcummi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-31-2012, 04:12 PM
  7. Replies: 5
    Last Post: 11-23-2009, 06:24 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