Results 1 to 2 of 2

Pivot data by value

Threaded View

Jbm444 Pivot data by value 06-11-2010, 04:58 PM
romperstomper Re: Pivot data by value 06-11-2010, 06:01 PM
  1. #1
    Registered User
    Join Date
    06-11-2010
    Location
    grinnell, iowa
    MS-Off Ver
    Excel 2007
    Posts
    79

    Pivot data by value

    Hi,
    I have data that looks like this:

    6/1/2009 Jack 301
    6/1/2009 Jane 503
    6/1/2009 Jilly 458
    7/1/2009 Jack 429
    7/1/2009 Jilly 562

    For about 100 rows. I need it to look like this, so I can compare the numerical data by month for each name.


    Date 6/1/09 7/1/09
    Jack 301 429
    Jane 503
    Jilly 458 562

    Here's what I have so far...

    Sub graphable()
    Dim RowCount    As Long
    Dim LastRow     As Long
    Dim i As Integer
    
    With Sheet2
        LastRow = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        RowCount = 1
        i = 1 + i
        For RowCount = 1 To LastRow
    If .Cells(RowCount, 2).Value Like "*Jack*" Then
    .Cells(RowCount, 2).Offset(0, 1).Value = .Cells(2, i).Value
    End If
    Next RowCount
    End With
    End Sub
    Now obviously this doesn't work, not least because I don't know how to use "i" to iterate by column. Also, clearly, the above was just a trial to see if I could get it to work with Jack -- the final code would have to include Jilly and Jane's data getting moved as well. Any ideas?

    *Edit: I realized this might not be clear: There are certain months for which I don't have numerical data for Jack, and certain months for which I don't have numerical data for Jane, etc. I need the code to recognize this, and place numerical data from further months further down the line, leaving the cell for where I don't have data blank. i.e. There is no row of data for Jane for 7/1/2009, but there is for 6/1 and 8/1. I need the code to just leave the cell in the new format corresponding to Jane 7/1/2009 blank.
    Last edited by Jbm444; 06-11-2010 at 05:13 PM.

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