Results 1 to 9 of 9

Thread: Complicated text rearrange
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Nov 2018
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Complicated text rearrange

    Hi I am hoping someone can help.

    Looking for a formula to use on a large excel sheet to rearrange the characters in a specific order. The following is an example.

    "1f6f33b9-35bc-6d4b-8377-ca5fc024eae1" to change to "b9336f1f-bc35-4b6d-8377-ca5fc024eae1"

    Basically the first set of 8 characters and the second 2 sets of 4 characters need to be in reverse order in batches of 2.

    Thank you in advance

  2. #2
    MrExcel MVP
    Junior Admin
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    50,720
    Post Thanks / Like
    Mentioned
    57 Post(s)
    Tagged
    11 Thread(s)

    Default Re: Complicated text rearrange

    For an entry in cell A1, try this formula:
    Code:
    =MID(A1,7,2)&MID(A1,5,2)&MID(A1,3,2)&LEFT(A1,2)&"-"&MID(A1,12,2)&MID(A1,10,2)&MID(A1,14,LEN(A1))
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  3. #3
    Board Regular steve the fish's Avatar
    Join Date
    Oct 2009
    Location
    Midlands, UK
    Posts
    7,643
    Post Thanks / Like
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)

    Default Re: Complicated text rearrange

    Depends if you had textjoin function:

    =TEXTJOIN(,,MID(A1,{7,5,3,1},2),"-",MID(A1,{12,10},2),"-",MID(A1,{17,15},2),MID(A1,19,LEN(A1)))

  4. #4
    New Member
    Join Date
    Nov 2018
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Complicated text rearrange

    Hi Joe4

    I have tried this which produces "b9336f1f-bc35-6d4b-8377-ca5fc024eae1". The second set of 4 characters "6d4b" also need reversing.

    Can you help please?

    Thank you

  5. #5
    MrExcel MVP Eric W's Avatar
    Join Date
    Aug 2015
    Location
    Bountiful, UT
    Posts
    8,628
    Post Thanks / Like
    Mentioned
    42 Post(s)
    Tagged
    5 Thread(s)

    Default Re: Complicated text rearrange

    If you have Excel 365 with the CONCAT function, this works:

    Code:
    =CONCAT(MID(A1,{7,5,3,1,9,12,10,14,17,15,19},{2,2,2,2,1,2,2,1,2,2,99}))
    Cheers,
    Eric

    When you eliminate the impossible, whatever remains, however improbable, must be the truth.

    -Posting guidelines, forum rules, terms of use, FAQs, BB codes, See how to search the forum
    -Post a screen shot with the HTML Maker

  6. #6
    New Member
    Join Date
    Nov 2018
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Complicated text rearrange

    steve the fish thank you that has worked great

  7. #7
    New Member
    Join Date
    Nov 2018
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Complicated text rearrange

    Thank you also Eric W

  8. #8
    MrExcel MVP
    Junior Admin
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    50,720
    Post Thanks / Like
    Mentioned
    57 Post(s)
    Tagged
    11 Thread(s)

    Default Re: Complicated text rearrange

    Sorry, I missed that there were two sets of 4.

    You already get better answers, but just to show you what that method I was using would look like, here it is:
    Code:
    =MID(A1,7,2)&MID(A1,5,2)&MID(A1,3,2)&LEFT(A1,2)&"-"&MID(A1,12,2)&MID(A1,10,2)&"-"&MID(A1,17,2)&MID(A1,15,2)&MID(A1,19,LEN(A1))
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  9. #9
    MrExcel MVP Eric W's Avatar
    Join Date
    Aug 2015
    Location
    Bountiful, UT
    Posts
    8,628
    Post Thanks / Like
    Mentioned
    42 Post(s)
    Tagged
    5 Thread(s)

    Default Re: Complicated text rearrange

    Glad we could help.
    Cheers,
    Eric

    When you eliminate the impossible, whatever remains, however improbable, must be the truth.

    -Posting guidelines, forum rules, terms of use, FAQs, BB codes, See how to search the forum
    -Post a screen shot with the HTML Maker

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •