+ Reply to Thread
Results 1 to 4 of 4

Expanding values/counts chart

Hybrid View

  1. #1
    Registered User
    Join Date
    07-08-2017
    Location
    -
    MS-Off Ver
    Windows 2010, primarily developing .xls
    Posts
    13

    Expanding values/counts chart

    Title is not very descriptive, sorry about that. Suppose column A contains a list of values (mine in particular are an ordered set of numbers), and column B contains a list of counts for those values. I'm trying to use formulas to have column C fill with each of the values in order, filling as many rows as the counts for that value.

    E.g. if
    - A1 = Foo
    - B1 = 2
    - A2 = Bar
    - B2 = 3

    Then C1:C5 should be {Foo, Foo, Bar, Bar, Bar}

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Expanding values/counts chart

    I would suggest a slight change to your layout - insert a blank row at the top, so that your data starts on row 2, and use column C as a helper column so that the output that you are wanting will be in column D (or E).

    Put zero in cell C1 and then this formula in C2:

    =IF(B2="","",B2+C1)

    Copy this down to the bottom of your data, and it will just produce a cumulative sum of the counts for each row. Then you can use this formula in D2 (or E2) to generate your list:

    =IF(ROWS($1:1)>MAX(C:C),"",INDEX(A:A,MATCH(ROWS($1:1)-1,C:C)+1))

    Copy this down as far as you need it (until you start to get blanks).

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    07-08-2017
    Location
    -
    MS-Off Ver
    Windows 2010, primarily developing .xls
    Posts
    13

    Re: Expanding values/counts chart

    Quote Originally Posted by Pete_UK View Post
    I would suggest a slight change to your layout - insert a blank row at the top, so that your data starts on row 2, and use column C as a helper column so that the output that you are wanting will be in column D (or E).

    Put zero in cell C1 and then this formula in C2:

    =IF(B2="","",B2+C1)

    Copy this down to the bottom of your data, and it will just produce a cumulative sum of the counts for each row. Then you can use this formula in D2 (or E2) to generate your list:

    =IF(ROWS($1:1)>MAX(C:C),"",INDEX(A:A,MATCH(ROWS($1:1)-1,C:C)+1))

    Copy this down as far as you need it (until you start to get blanks).

    Hope this helps.

    Pete
    Thanks, that worked perfectly!

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Expanding values/counts chart

    That's good to hear - thanks for the rep.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark this thread as SOLVED.

    Pete

+ 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. Expanding Pie Chart Section
    By vha7 in forum Excel General
    Replies: 2
    Last Post: 10-15-2018, 10:58 AM
  2. Replies: 1
    Last Post: 07-13-2018, 06:17 PM
  3. [SOLVED] Expanding a summary cell into individual counts...opposite of consolidate?
    By blin100 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2015, 09:10 AM
  4. Expanding my list for the chart....
    By mark_sheffield in forum Excel General
    Replies: 2
    Last Post: 07-12-2010, 06:49 AM
  5. Expanding Chart
    By leem in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2010, 09:48 AM
  6. expanding frequencies/counts
    By Doug-E in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-17-2005, 01:18 AM
  7. [SOLVED] Auto Expanding Pie Chart
    By Edgar Thoemmes in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-09-2005, 12:06 AM

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