+ Reply to Thread
Results 1 to 11 of 11

Arrange rows based upon a number in text of first cell

  1. #1
    Registered User
    Join Date
    09-19-2016
    Location
    Muscat, Oman
    MS-Off Ver
    365
    Posts
    56

    Arrange rows based upon a number in text of first cell

    I have 211 rows. The first cell in each row has text, then "EURUSD" and then a number. I need a way to automatically arrange the rows, grouping the items by that differentiating number (i.e. all "1's" together, all "5's" together, etc.).

    I have attached an example. Sheet1 is the data. Sheet2 shows how I was doing this manually.

    Is there a way to do this with VBA?

    I thank you in advance for your guidance.

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Arrange rows based upon a number in text of first cell

    Hi stearno,

    There's no attachment showing. Please check the top yellow banner on how to attach a file

  3. #3
    Registered User
    Join Date
    09-19-2016
    Location
    Muscat, Oman
    MS-Off Ver
    365
    Posts
    56

    Re: Arrange rows based upon a number in text of first cell

    Sorry, its attached now.
    Attached Files Attached Files

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Arrange rows based upon a number in text of first cell

    What does "GL_L1_EURUSD1" refer to from Sheet1 ? I can't relate & couldn't figure out how you arrived at 1.17670428571428 in Sheet2 under 2020.08.10 18:22:22

  5. #5
    Registered User
    Join Date
    09-19-2016
    Location
    Muscat, Oman
    MS-Off Ver
    365
    Posts
    56

    Re: Arrange rows based upon a number in text of first cell

    I did a cut and paste. I cut "GL_L1_EURUSD1" from Sheet1 and pasted it into Sheet2. Thats why its not in Sheet1 anymore. But it used to be in one of the blank rows in Sheet1.

  6. #6
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Arrange rows based upon a number in text of first cell

    Just to confirm, so any cell in column A of Sheet1 that ends with "EURUSD1" has to be transferred to Sheet2 ?

  7. #7
    Registered User
    Join Date
    09-19-2016
    Location
    Muscat, Oman
    MS-Off Ver
    365
    Posts
    56
    Quote Originally Posted by nankw83 View Post
    Just to confirm, so any cell in column A of Sheet1 that ends with "EURUSD1" has to be transferred to Sheet2 ?
    Correct, step 1: move EURUSD1 to sheet2. Then step2: move all EURUSD5 under EURUSD1 on sheet2, then step3 move all EURUSD15 under EURUSD5 on sheet2, etc. Until all the data on sheet1 is on sheet2, but arranged in groups.

  8. #8
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Arrange rows based upon a number in text of first cell

    Try the below code & let me know if this is what you're looking for

    Please Login or Register  to view this content.
    Last edited by nankw83; 08-11-2020 at 07:35 AM. Reason: Edited code to insert blank rows between each group
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  9. #9
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: Arrange rows based upon a number in text of first cell

    Hi

    My code is a bit longer, but hopefully does what you ask for.
    In the attached file, I make a copy of your Sheet1 - (named the processed sheet as "output") for testing.
    For convenience, I added a button and assigned my macro to the button.
    Click the button to sort the data into groups.
    Having another method doesn't hurt.

    zeddy

  10. #10
    Registered User
    Join Date
    09-19-2016
    Location
    Muscat, Oman
    MS-Off Ver
    365
    Posts
    56

    Re: Arrange rows based upon a number in text of first cell

    Thank you guys, that worked! I appreciate the help!

  11. #11
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Arrange rows based upon a number in text of first cell

    Glad to help ... If that takes care of your original request, please mark the thread as 'SOLVED' from the Thread Tools menu above the first post & consider adding Reputation by clicking the star icon below their usernames to those who have helped

+ 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. Replies: 1
    Last Post: 10-03-2017, 10:54 AM
  2. [SOLVED] Filling n number of rows based on Number in cell.
    By catscats11 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-16-2017, 10:26 AM
  3. Replies: 12
    Last Post: 01-31-2015, 02:11 AM
  4. [SOLVED] insert rows based on number in cell and copy the data down into the new rows
    By pziefle in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-05-2013, 11:19 AM
  5. [SOLVED] Insert Multiple Rows Based Off Number in Cell and Copy Data From Above New Rows
    By tstell1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2012, 04:15 PM
  6. [SOLVED] Excel VBA/Macro - Copy Number of Rows based on the number in a cell to another sheet
    By diane.alexander58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2012, 11:32 AM
  7. VBA code to unhide X number of rows based on a number entered into a cell above
    By gazza365 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2010, 08:48 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