+ Reply to Thread
Results 1 to 4 of 4

Sorting through arrays of data

  1. #1
    Registered User
    Join Date
    09-16-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Sorting through arrays of data

    I have an array with 2 columns. Column 1 consists of dates. Column 2 consists of values. Column 1 has some dates that are the exact same date/time. the number of the exact dates vary. for example..
    9/13/2013 18:28 1.234499
    9/13/2013 18:28 1.301656
    9/13/2013 18:28 1.291451
    9/13/2013 18:28 1.291451
    9/13/2013 18:28 1.283294
    9/13/2013 19:28 1.250881
    9/13/2013 19:28 1.332271
    9/13/2013 19:28 1.322066
    9/13/2013 19:28 1.311861
    9/13/2013 19:28 1.311861
    9/13/2013 19:28 1.303704
    9/13/2013 20:28 1.256996
    9/13/2013 20:28 1.336363
    9/13/2013 20:28 1.322066

    I want to take the "last value" for each date and sort them out so I get a new array that would look like this..

    9/13/2013 18:28 1.283294
    9/13/2013 19:28 1.303704
    9/13/2013 20:28 1.322066



    And I need some serious help:/

    Thank you for looking !

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Sorting through arrays of data

    engineernoob,

    Welcome to the Excel Forum.

    With your raw data (already sorted/grouped per your screenshot) in columns A and B, beginning in cell A1, the below macro will create the results in columns E and F, beginning in cell E1. And, there can not be any blank cells in columns A and B.

    If the above statement is not correct, then I will have to see your actual raw data, and, I will adjust the macro.

    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code
    2. Open your NEW workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgData macro.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    09-16-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Sorting through arrays of data

    Thank you for the welcome and thank you for the macro! It works exactly how I wanted.

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Sorting through arrays of data

    engineernoob,

    You are very welcome. Glad I could help.

    Thanks for the feedback.

    And, come back anytime.

+ 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. Comparing to Arrays and Sorting
    By ebase131 in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 01-08-2013, 02:54 PM
  2. Question sorting text to columns & fetching data from arrays.
    By J-Style in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-02-2012, 07:20 AM
  3. VBA arrays in a range: sorting
    By zeno1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-27-2012, 02:28 PM
  4. Sorting arrays using VBA?
    By gryffin13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2012, 02:41 PM
  5. joining and sorting two arrays
    By Paul134 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-10-2008, 11:18 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