+ Reply to Thread
Results 1 to 4 of 4

converting a column of repeating data to rows?

Hybrid View

  1. #1
    Registered User
    Join Date
    02-03-2010
    Location
    Loughborough
    MS-Off Ver
    Excel 2007
    Posts
    1

    converting a column of repeating data to rows?

    I am importing a data file which is a single long column of data in repeating rows of 12 and 1 space. How can I get these into a Table format that I can use in my pivot table? . Eg

    Male
    25
    John
    French
    left handed

    female
    23
    Louise
    English
    Left handed

    etc

    to
    Male | 25 | John | French | Lefthanded
    Female | 23| Louise | English | Left Handed
    Etc

    Thanks
    Simon

  2. #2
    Forum Contributor vikas.bhandari's Avatar
    Join Date
    04-07-2006
    Location
    Delhi, India
    MS-Off Ver
    Office 2007 and 2010
    Posts
    303

    Talking Re: converting a column of repeating data to rows?

    Not sure if you are looking for the same. Please find attached an example. It is purely formula based and not done through programming atall.

    hth,
    Vikas
    Attached Files Attached Files

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: converting a column of repeating data to rows?

    Vikas, if you're interested (?) I suspect you could simplify your approach... using your file as example:

    'Table Output'
    
    A2: 
    =IF(ROWS(A$2:A2)>COUNTA(InputData!$D:$D)/5,"",ROWS(A$2:A2))
    copied down to A29
    
    B2: 
    =IF($A2="","",INDEX(InputData!$D:$D,5+(COLUMNS($B2:B2)-1)+(5+1)*(ROWS(B$2:B2)-1)))
    applied to matrix B2:F29

    ie no need for A:C etc on InputData sheet

    the instances of "5" in the above could of course be replaced by a cell which details number of fields per "block"
    (the use of +1 assumes 1 blank interspersed between blocks - again could be altered as required)

  4. #4
    Forum Contributor vikas.bhandari's Avatar
    Join Date
    04-07-2006
    Location
    Delhi, India
    MS-Off Ver
    Office 2007 and 2010
    Posts
    303

    Re: converting a column of repeating data to rows?

    Thanks so much for the updated code Mr. Moderator. I am loving reading your posts these days btw. For example, if you check this post :
    http://www.excelforum.com/excel-prog...-in-cells.html

    I didn't know that the problem is actually Application.Volatile. I got the solution from your "My Recommended reading" Section.

    Thanks sir
    Vikas

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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