+ Reply to Thread
Results 1 to 5 of 5

Counts Expanding

Hybrid View

sathishkm Counts Expanding 04-13-2021, 01:08 AM
jindon Re: Counts Expanding 04-13-2021, 01:58 AM
sathishkm Re: Counts Expanding 04-13-2021, 03:32 PM
Bo_Ry Re: Counts Expanding 04-13-2021, 02:42 AM
kvsrinivasamurthy Re: Counts Expanding 04-13-2021, 03:09 AM
  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Counts Expanding

    Hi All,

    I have company names in column A and there counts in column B. I need to expand the companies according to the count mentions in columns B. Please find the attachment.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Counts Expanding

    Try
    Sub test()
        Dim a, b, i As Long, ii As Long, n As Long
        With Cells(1).CurrentRegion
            a = .Value
            ReDim b(1 To Application.Sum(.Columns(2)), 1 To 1)
        End With
        For i = 2 To UBound(a, 1)
            For ii = 1 To a(i, 2)
                n = n + 1: b(n, 1) = a(i, 1)
        Next ii, i
        [d2].Resize(n) = b
    End Sub

  3. #3
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Re: Counts Expanding

    Thanks. I got what I was expecting it

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Counts Expanding

    Please try

    Sub ex()
    Dim a
    With Range("A2", Cells(Rows.Count, 1).End(xlUp))
        a = Split(Join(Application.Transpose(Evaluate("Rept(" & .Address & "&""|""," & .Offset(, 1).Address & ")")), ""), "|")
        [d2].Resize(UBound(a)) = Application.Transpose(a)
    End With
    End Sub

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Counts Expanding

    If you are interested in FORMULA solution.
    ARRAY formula in F2 then copied down till blank cells are seen.
    =IFERROR(INDEX($A$2:$A$5,SMALL(IF(SUMIF(OFFSET($B$2,0,0,ROW($B$2:$B$5)-ROW($B$1)),">0")>=ROWS($F$2:$F2),ROW($B$2:$B$5),""),1)-ROW($B$1)),"")
    To enter ARRAY formula
    Copy and paste the formula in cell
    Press F2
    Press Ctrl+Shift+Enter together
    Excel covers the formula with {}.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

+ 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] Subtracting one sum of counts from another sum of counts in a pivot table
    By steve78 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-07-2019, 01:35 PM
  2. Expanding values/counts chart
    By Unome in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-18-2018, 06:28 PM
  3. Replies: 1
    Last Post: 07-13-2018, 06:17 PM
  4. [SOLVED] Expanding an IF formula
    By JakeMann in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-04-2017, 11:42 AM
  5. [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
  6. Expanding Group using VBA
    By Sachburger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-16-2013, 11:10 AM
  7. expanding frequencies/counts
    By Doug-E in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-17-2005, 01:18 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