+ Reply to Thread
Results 1 to 6 of 6

Sorting Data across rows

Hybrid View

  1. #1
    Registered User
    Join Date
    10-13-2012
    Location
    Nutley,NJ
    MS-Off Ver
    Excel 2011
    Posts
    77

    Sorting Data across rows

    I've attached the spreadsheet I want to use. As you can see there are three sets of "bootcamper name" and "time" columns

    I wanted to know how I can sort by name or time if I were fill in data that started from A7 and B7 all the way down to A43 and B43
    then restarts at C7 and D7 all the way down to let's sat C30 and D30

    If I wanted to list all the data alphabetically ( or by time ) from A7 and B7 all the way down to C30 and D30, how can I do that? Is is possible?

    Please and thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,419

    Re: Sorting Data across rows

    it's possible when you use a macro (VBA)

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Sorting Data across rows

    Not sure exactly what you want to see - you didnt give any data, nor any sample results - but you can sort by row, using the exact same process as a regular sort, but click the OPTIONS button and select Row
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    10-13-2012
    Location
    Nutley,NJ
    MS-Off Ver
    Excel 2011
    Posts
    77

    Re: Sorting Data across rows

    So I entered in data to make it easier...how can I situate the sorting so upon completion
    (this would be an alphabetical sort
    A7 would be Amy B7 would be 13
    A8 would be Bill B8 would be 27
    A9 would be Rick B9 would be 24

    Terrible Tuesday.xlsx

  5. #5
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,419

    Re: Sorting Data across rows

    copy and paste this in a module and run the macro
    Sub Sorteren()
      Dim a, r%, k%, Dict As Object, b, splits, c As Range
    
      Set c = Sheets("sheet1").Range("A7:F100")
      a = c.Value
    
      Set Dict = CreateObject("system.collections.arraylist")
      With Dict
    
        For r = 1 To UBound(a)
          For k = 1 To UBound(a, 2) Step 2
            If Not (IsEmpty(a(r, k))) Then .Add Left(a(r, k) & Space(50), 50) & Chr(2) & a(r, k + 1)
          Next
        Next
        .Sort
        a = .toarray
      End With
    
      ReDim b(1 To 1 + Int(UBound(a) / 3), 1 To 6)
      For r = 0 To UBound(a)
        splits = Split(a(r), Chr(2))
        b(1 + Int(r / 3), 1 + 2 * (r Mod 3)) = Trim(splits(0))
        b(1 + Int(r / 3), 2 + 2 * (r Mod 3)) = CDbl(splits(1))
      Next
    
      With c
        .ClearContents
        .Resize(UBound(b), UBound(b, 2)).Value = b
      End With
    End Sub

  6. #6
    Registered User
    Join Date
    10-13-2012
    Location
    Nutley,NJ
    MS-Off Ver
    Excel 2011
    Posts
    77

    Re: Sorting Data across rows

    thank you!

+ 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. When sorting data in rows does not move
    By SC1881 in forum Excel General
    Replies: 0
    Last Post: 09-05-2012, 11:12 PM
  2. sorting data and inserting rows
    By zed commander in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-15-2012, 06:41 AM
  3. Excel 2007 : Sorting Rows of data into one column
    By Mike74 in forum Excel General
    Replies: 5
    Last Post: 04-26-2010, 03:38 PM
  4. Combining & Sorting Rows of Data
    By NewExcelUser in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-05-2007, 01:03 AM
  5. Sorting data rows independently
    By guillemot in forum Excel General
    Replies: 0
    Last Post: 12-22-2005, 12:54 AM

Tags for this Thread

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