+ Reply to Thread
Results 1 to 3 of 3

Turning frequency tables into raw data

Hybrid View

  1. #1
    Registered User
    Join Date
    04-22-2015
    Location
    london,england
    MS-Off Ver
    10
    Posts
    2

    Turning frequency tables into raw data

    I would like to be able to convert a table into raw data. I know there is a way of doing it in excel but can't remember how to do it. Would like to convert a list like this...

    Ford 1
    Audi 5
    BMW 3

    into this

    Ford
    Audi
    Audi
    Audi
    Audi
    Audi
    BMW
    BMW
    BMW

    I think you need to add a column, as in below but can't remember the formular to generate the output

    1 ford 1
    6 audi 5
    9 BMW 3

    Thanks

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Turning frequency tables into raw data

    Try this Macro


    Sub Macro1()
    '
    ' Macro1 Macro
    '
        Sheets("Sheet1").Select
        Pos = 1
        
    LoopStart:
        Entry = Split(Cells(Pos, 1).Value, " ")
        If Entry(1) * 1 > 1 Then
        Rows(Pos + 1 & ":" & Pos + Entry(1) * 1 - 1).Select
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        Range(Cells(Pos, 1), Cells(Pos + Entry(1) * 1 - 1, 1)).Value = Entry(0)
        Pos = Pos + Entry(1) * 1
        Else
        Cells(Pos, 1).Value = Entry(0)
        Pos = Pos + 1
        End If
        If Cells(Pos, 1) <> "" Then GoTo LoopStart
        Range("A1").Select
    End Sub
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Turning frequency tables into raw data

    Is this what you were remembering?

    Row\Col
    A
    B
    C
    D
    1
    Type
    Qty
    Helper
    2
    Ford
    1
    0
    C2: =SUM(B1:C1)
    3
    Audi
    5
    1
    4
    BMW
    3
    6
    5
    9
    6
    7
    Ford A7: =INDEX(A$2:A$5, MATCH(ROWS(A$7:A7) - 1, $C$2:$C$5)) & ""
    8
    Audi
    9
    Audi
    10
    Audi
    11
    Audi
    12
    Audi
    13
    BMW
    14
    BMW
    15
    BMW
    16
    Last edited by shg; 04-22-2015 at 02:01 PM.
    Entia non sunt multiplicanda sine necessitate

+ 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. Replies: 4
    Last Post: 03-26-2012, 03:48 AM
  2. Replies: 2
    Last Post: 10-27-2011, 12:25 PM
  3. Turning columns into tables
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-14-2010, 04:53 PM
  4. Frequency Tables, Categorical Data, Multiple Columns
    By quanimal in forum Excel General
    Replies: 2
    Last Post: 09-14-2010, 04:29 PM
  5. Frequency in large data tables
    By Kasperstender in forum Excel General
    Replies: 10
    Last Post: 11-11-2009, 10:35 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