+ Reply to Thread
Results 1 to 9 of 9

Possible to switch numbers around?

  1. #1
    Registered User
    Join Date
    06-18-2020
    Location
    New Zealand
    MS-Off Ver
    Microsoft 365 for enterprise
    Posts
    5

    Possible to switch numbers around?

    Hi,

    I have a column with entries like so,

    POINT (174.7753931 -36.8867484)
    POINT (174.7749403 -36.89297140000001)
    POINT (174.7604037 -36.8692689)



    Is it possible to switch it so it reads?

    POINT (-36.8867484 174.7753931)
    POINT (-36.89297140000001 174.7749403)
    POINT (-36.8692689 174.7604037)

    Thank you
    Last edited by James432213; 06-18-2020 at 07:22 PM.

  2. #2
    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,044

    Re: Possible to switch numbers around?

    Are there always only ever 2 numbers?
    Do they always have a space between them?
    Is that the only space in that string?
    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

  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,044

    Re: Possible to switch numbers around?

    If your data starts in L4...
    ="POINT ("&LEFT(MID(L4,FIND("(",L4)+1,99),FIND(" ",MID(L4,FIND("(",L4)+1,99))-1)&" -"&LEFT(MID(L4,FIND("-",L4)+1,99),LEN(MID(L4,FIND("-",L4)+1,99))-2)&")"

    Hopefully some1 will be able to simplify that for you (wife is calling me for supper)

  4. #4
    Registered User
    Join Date
    06-18-2020
    Location
    New Zealand
    MS-Off Ver
    Microsoft 365 for enterprise
    Posts
    5

    Re: Possible to switch numbers around?

    Quote Originally Posted by FDibbins View Post
    Are there always only ever 2 numbers?
    Yes
    Quote Originally Posted by FDibbins View Post
    Do they always have a space between them?
    Yes
    Quote Originally Posted by FDibbins View Post
    Is that the only space in that string?
    There are two spaces, one between "POINT (" and one between the two numbers

  5. #5
    Registered User
    Join Date
    06-18-2020
    Location
    New Zealand
    MS-Off Ver
    Microsoft 365 for enterprise
    Posts
    5

    Re: Possible to switch numbers around?

    Quote Originally Posted by FDibbins View Post
    If your data starts in L4...
    ="POINT ("&LEFT(MID(L4,FIND("(",L4)+1,99),FIND(" ",MID(L4,FIND("(",L4)+1,99))-1)&" -"&LEFT(MID(L4,FIND("-",L4)+1,99),LEN(MID(L4,FIND("-",L4)+1,99))-2)&")"

    Hopefully some1 will be able to simplify that for you (wife is calling me for supper)
    Thank you

    but I'm a complete noob with Excel, how do I use this? Also, by L4 do you mean column letter L and row 4?

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,463

    Re: Possible to switch numbers around?

    Since, as a localized "earth" coordinate, your second number will always start with a minus sign, and assuming your data is in Column A starting on Row 1, here is another formula that you can consider...

    ="POINT ("&SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("-",A1),99),")"," ")&LEFT(A1,FIND("-",A1)-2),"POINT (","")&")"
    Last edited by Rick Rothstein; 06-18-2020 at 07:22 PM.

  7. #7
    Registered User
    Join Date
    06-18-2020
    Location
    New Zealand
    MS-Off Ver
    Microsoft 365 for enterprise
    Posts
    5

    Re: Possible to switch numbers around?

    Quote Originally Posted by Rick Rothstein View Post
    Since, as a localized "earth" coordinate, your second number will always start with a minus sign, and assuming your data is in Column A starting on Row 1, here is another formula that you can consider...

    ="POINT ("&SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("-",A1),99),")"," ")&LEFT(A1,FIND("-",A1)-2),"POINT (","")&")"
    Thank you so much!

    How would I do the opposite?

    So,

    POINT (-36.8867484 174.7753931)
    POINT (-36.89297140000001 174.7749403)
    POINT (-36.8692689 174.7604037)

    becomes

    POINT (174.7753931 -36.8867484)
    POINT (174.7749403 -36.89297140000001)
    POINT (174.7604037 -36.8692689)

  8. #8
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,463

    Re: Possible to switch numbers around?

    Quote Originally Posted by James432213 View Post
    How would I do the opposite?
    Give this formula a try...

    =SUBSTITUTE(LEFT(A1,FIND(" ",A1,FIND("(",A1))-1)&")","(","("&SUBSTITUTE(MID(A1,FIND(" ",A1,FIND("(",A1))+1,99),")"," "))

  9. #9
    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,044

    Re: Possible to switch numbers around?

    Nicely done Rick, I was having a brain phart.

+ 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: 4
    Last Post: 09-25-2019, 08:26 PM
  2. Switch dates/week numbers
    By DavidDK in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-24-2017, 07:56 AM
  3. Convert numbers - switch commas for decimals and vice versa
    By shdwfx in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-14-2016, 03:43 PM
  4. [SOLVED] Toggle option buttons to switch numbers
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-10-2015, 07:50 AM
  5. Replies: 0
    Last Post: 04-22-2014, 10:59 AM
  6. Stop Numbers Auto Switch to Date
    By ElJay in forum Excel General
    Replies: 2
    Last Post: 03-13-2009, 06:38 PM
  7. [SOLVED] How to switch column headers from numbers back to letters?
    By Measurement Consultant in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-14-2006, 11:35 AM

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