+ Reply to Thread
Results 1 to 7 of 7

Moving Rows to Columns

  1. #1
    Registered User
    Join Date
    03-17-2014
    Location
    Staten Island, nY
    MS-Off Ver
    Excel 2003
    Posts
    3

    Moving Rows to Columns

    I created a report that has all of my deduction codes listed in rows by employee ID. I would like to move each deduction code to its own column at the top. Is there anyway this can be done without manually moving each row to the top and inserting the amounts under the column? I have attached a sample.
    Attached Files Attached Files

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Moving Rows to Columns

    Does this get you close? I had to delete the 1st sheet because of file size
    Attached Files Attached Files
    Last edited by judgeh59; 03-17-2014 at 02:42 PM.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

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

    Re: Moving Rows to Columns

    Insert a new column C and put this formula in C2:

    =IF(A2="","-",A2&"_"&COUNTIF(A$2:A2,A2))

    Then copy it down to the bottom of your list by double-clicking the fill handle (the small black square in the bottom right corner of the cursor, with C2 selected).

    Then you need to obtain a unique list of your codes, so highlight all the entries in column A (including the header), then use Advanced Filter - ensure that the range shown in the dialogue box is correct (A1:A3647), click against Copy to Another Location, put J1 in the Copy To box, then click Unique Records only, then click OK. You should see your codes listed in column J, down to J22. Copy the range J2:J22, move the cursor to K1, then right-click and choose Paste Special | Values | Transpose | OK then press the <Esc> key - this should have put your unique codes on the top row, starting in K1.

    Then put this formula in K2:

    =IF(ISNA(MATCH(K$1&"_"&ROWS($1:1),$C:$C,0)),"",INDEX($B:$B,MATCH(K$1&"_"&ROWS($1:1),$C:$C,0)))

    and copy this across to AE2 (i.e. under the W). Then you can copy K2:AE2 down as far as you need to. You could put this formula in I2:

    =COUNTIF(A:A,J2)

    and copy it down, to tell you how many entries you need for each code.

    Then you can delete columns D to J.

    Hope this helps - I've assumed that your profile entry showing XL 2003 is correct.

    Pete

  4. #4
    Registered User
    Join Date
    03-17-2014
    Location
    Staten Island, nY
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Moving Rows to Columns

    Thank you so much judgeH!! The formual works but only for the first cell of each column. When I try to copy down it gives me the green triangle in the corner but no number prefills in the space? What am I doing wrong?
    Last edited by rhondaly; 03-18-2014 at 10:52 AM. Reason: needed to edit to correct sender of my reply

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Moving Rows to Columns

    more than likely it's a cell referencing issue....looking at the $ and where they are placed....it worked in the file I uploaded....you may have to really check the cell references and make sure they are correct when you copied the formulas....

  6. #6
    Registered User
    Join Date
    03-17-2014
    Location
    Staten Island, nY
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Moving Rows to Columns

    I got it. It was definitely me :-). Thank you so much.

    ***************

  7. #7
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Moving Rows to Columns

    Please remember to set the thread to Solved...If you feel I deserve an increase in my reputation, feel free to click on the star in the lower left of the thread. Remember, someday when you help somebody they may add to your rep points, and it could be me...just a thought...

+ 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. Moving data from columns to rows
    By nobleprince in forum Excel General
    Replies: 0
    Last Post: 02-01-2012, 01:57 PM
  2. Moving Rows Up Into Columns where value is equal to
    By MDM_ in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-30-2009, 09:59 AM
  3. Another question moving rows to columns
    By fivestringfreak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2005, 03:45 AM
  4. Moving rows to columns
    By Jan Verten in forum Excel General
    Replies: 5
    Last Post: 09-02-2005, 12:05 PM
  5. Moving columns into rows
    By jim314 in forum Excel General
    Replies: 1
    Last Post: 03-30-2005, 06:06 PM

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