+ Reply to Thread
Results 1 to 5 of 5

Rearranging categorical data into two columns

  1. #1
    Registered User
    Join Date
    11-12-2012
    Location
    The Hague, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    3

    Rearranging categorical data into two columns

    I need to convert a table with multiple columns into one with two columns only, which denote all the possible interactions. I have categorical data on topics present (1) or not (0) in different text sections (ID). The format is the following:

    ID 105 101 108 202 ... 2099
    1 1 1 1 0 ... 0
    2 1 0 1 0 ... 0
    3 1 1 0 1 ... 0
    ...

    The column titles correspond to different topics and do not contain all numbers between 1 and 2099. I need to convert the data in the following format:

    Var1 Var2
    105 101
    105 108
    101 108
    105 108
    105 101
    105 101
    105 202
    101 202
    ...

    Unfortunatelly, macros are not my strong side. What VBA do i need in order to do this?

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Rearranging categorical data into two columns

    Hi petyaall,
    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  3. #3
    Registered User
    Join Date
    11-12-2012
    Location
    The Hague, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Rearranging categorical data into two columns

    Ok. Here's a slightly bigger extraction from my data. The file contains two sheets - before and after - as you suggested.
    Attached Files Attached Files

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Rearranging categorical data into two columns

    Hi Petya,
    try it
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-12-2012
    Location
    The Hague, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Rearranging categorical data into two columns

    Nilem, thank you very much! I manged to run the macro on my full dataset and i think it works, conisidering that the total number of transactions estimated by it is the expected number.

    I hope one day i will be able to write such codes myself. Thanks again!

+ 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. Rearranging data from multiple rows to columns
    By tessda in forum Excel General
    Replies: 2
    Last Post: 09-17-2011, 12:58 AM
  2. Excel 2007 : Splitting categorical data
    By Banach89 in forum Excel General
    Replies: 0
    Last Post: 06-21-2011, 05:21 AM
  3. Frequency Tables, Categorical Data, Multiple Columns
    By quanimal in forum Excel General
    Replies: 2
    Last Post: 09-14-2010, 04:29 PM
  4. Splitting cells, rearranging columns and rows, cleaning up data
    By daniel.henriksen in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-11-2010, 03:55 AM
  5. help needed rearranging columns data to row (complex)
    By ZeroKalvin in forum Excel General
    Replies: 0
    Last Post: 03-30-2005, 02:31 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