Excel formula to split a cell and reverses the order












1















An example source cell would be something like:



Some:Thing:random:here


I want to transform it to this (reversing the order of each group):



here:random:Thing:Some


I would prefer a formula, without using macros, if possible.



This is the formula I've been trying to manipulate to change the last part of an IP.




=IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT("",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT("> ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))











share|improve this question

























  • I've been trying to manipulate a formula that I use to change the last part of an IP. =IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))

    – BondUniverse
    Sep 26 '13 at 16:47













  • The commas wont be in a set location would they? Wo;; there always be three columns?

    – PsychoData
    Sep 26 '13 at 17:04













  • Why are you avoiding macros? This can be cleanly solved with a small User-Defined Function.

    – Dane
    Sep 26 '13 at 17:15











  • There will prob. always be 3 ".", so 4 parts of data (although the last part could have extra stuff after it). In a perfect world, I would like it to be dynamic, but I'd be more than happy with the 4 parts (3 separators). The length of each "part" will vary some...

    – BondUniverse
    Sep 26 '13 at 20:37
















1















An example source cell would be something like:



Some:Thing:random:here


I want to transform it to this (reversing the order of each group):



here:random:Thing:Some


I would prefer a formula, without using macros, if possible.



This is the formula I've been trying to manipulate to change the last part of an IP.




=IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT("",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT("> ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))











share|improve this question

























  • I've been trying to manipulate a formula that I use to change the last part of an IP. =IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))

    – BondUniverse
    Sep 26 '13 at 16:47













  • The commas wont be in a set location would they? Wo;; there always be three columns?

    – PsychoData
    Sep 26 '13 at 17:04













  • Why are you avoiding macros? This can be cleanly solved with a small User-Defined Function.

    – Dane
    Sep 26 '13 at 17:15











  • There will prob. always be 3 ".", so 4 parts of data (although the last part could have extra stuff after it). In a perfect world, I would like it to be dynamic, but I'd be more than happy with the 4 parts (3 separators). The length of each "part" will vary some...

    – BondUniverse
    Sep 26 '13 at 20:37














1












1








1


1






An example source cell would be something like:



Some:Thing:random:here


I want to transform it to this (reversing the order of each group):



here:random:Thing:Some


I would prefer a formula, without using macros, if possible.



This is the formula I've been trying to manipulate to change the last part of an IP.




=IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT("",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT("> ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))











share|improve this question
















An example source cell would be something like:



Some:Thing:random:here


I want to transform it to this (reversing the order of each group):



here:random:Thing:Some


I would prefer a formula, without using macros, if possible.



This is the formula I've been trying to manipulate to change the last part of an IP.




=IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT("",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT("> ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))








microsoft-excel microsoft-excel-2010






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 27 '16 at 14:44









Hennes

59.1k792141




59.1k792141










asked Sep 26 '13 at 14:36









BondUniverseBondUniverse

1824620




1824620













  • I've been trying to manipulate a formula that I use to change the last part of an IP. =IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))

    – BondUniverse
    Sep 26 '13 at 16:47













  • The commas wont be in a set location would they? Wo;; there always be three columns?

    – PsychoData
    Sep 26 '13 at 17:04













  • Why are you avoiding macros? This can be cleanly solved with a small User-Defined Function.

    – Dane
    Sep 26 '13 at 17:15











  • There will prob. always be 3 ".", so 4 parts of data (although the last part could have extra stuff after it). In a perfect world, I would like it to be dynamic, but I'd be more than happy with the 4 parts (3 separators). The length of each "part" will vary some...

    – BondUniverse
    Sep 26 '13 at 20:37



















  • I've been trying to manipulate a formula that I use to change the last part of an IP. =IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))

    – BondUniverse
    Sep 26 '13 at 16:47













  • The commas wont be in a set location would they? Wo;; there always be three columns?

    – PsychoData
    Sep 26 '13 at 17:04













  • Why are you avoiding macros? This can be cleanly solved with a small User-Defined Function.

    – Dane
    Sep 26 '13 at 17:15











  • There will prob. always be 3 ".", so 4 parts of data (although the last part could have extra stuff after it). In a perfect world, I would like it to be dynamic, but I'd be more than happy with the 4 parts (3 separators). The length of each "part" will vary some...

    – BondUniverse
    Sep 26 '13 at 20:37

















I've been trying to manipulate a formula that I use to change the last part of an IP. =IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))

– BondUniverse
Sep 26 '13 at 16:47







I've been trying to manipulate a formula that I use to change the last part of an IP. =IF(C12="","",SUBSTITUTE(LEFT(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2)&MID(SUBSTITUTE(C12,".","."&REPT(" ",LEN(C12))),LEN(C12)*2,LEN(C12))&"5"," ",""))

– BondUniverse
Sep 26 '13 at 16:47















The commas wont be in a set location would they? Wo;; there always be three columns?

– PsychoData
Sep 26 '13 at 17:04







The commas wont be in a set location would they? Wo;; there always be three columns?

– PsychoData
Sep 26 '13 at 17:04















Why are you avoiding macros? This can be cleanly solved with a small User-Defined Function.

– Dane
Sep 26 '13 at 17:15





Why are you avoiding macros? This can be cleanly solved with a small User-Defined Function.

– Dane
Sep 26 '13 at 17:15













There will prob. always be 3 ".", so 4 parts of data (although the last part could have extra stuff after it). In a perfect world, I would like it to be dynamic, but I'd be more than happy with the 4 parts (3 separators). The length of each "part" will vary some...

– BondUniverse
Sep 26 '13 at 20:37





There will prob. always be 3 ".", so 4 parts of data (although the last part could have extra stuff after it). In a perfect world, I would like it to be dynamic, but I'd be more than happy with the 4 parts (3 separators). The length of each "part" will vary some...

– BondUniverse
Sep 26 '13 at 20:37










3 Answers
3






active

oldest

votes


















3














Assuming three colons as separators try this formula



=IF(C12="","",TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),200,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),100,100))&":"&LEFT(C12,FIND(":",C12)-1))



Explanation:



To get the part after the last colon I used this formula:



=TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))



That uses SUBSTITUTE to replace each colon with 100 spaces. As we are dealing with IP addresses each part is clearly a small number of characters so then using MID to take 100 characters starting at char 300 will include only the last part of the IP address and some spaces - TRIM then trims the spaces - I used the same approach to get the middle two parts and then LEFT function combined with FIND to get the first part






share|improve this answer


























  • This works perfectly! Thank you!

    – BondUniverse
    Sep 26 '13 at 20:50











  • This is kinda brilliant. It took me a bit to parse it. Any chance you'd explain what you're doing?

    – Dane
    Sep 26 '13 at 21:25



















1














Assuming it is an IP address 1.2.3.4



dim astring as string
dim splat() as variant

astring = "1.2.3.4"
splat =split(string,".")
string=splat(3)&"."& splat(2)&"."& splat(1)&"."&splat(0)





share|improve this answer

































    0














    So, there may be a way to solve this without using VBA, but here is a user-defined formula you can use to do exactly what you're asking for, as well as handle different delimiters:



    Function ReverseList(InputString As String, Optional DelimiterString As String) As String

    ' Provide a default value of "," as the delimiter.
    If Len(DelimiterString) = 0 Then
    LabelString = ","
    End If

    ' The InputArray() will contain the values, separated at the delimiter string.
    Dim InputArray() As String
    InputArray() = Split(InputString, DelimiterString)

    ' The OutputArray() will contain the values in reverse order.
    Dim i As Integer
    Dim j As Integer
    j = UBound(InputArray)
    Dim OutputArray() As String
    ReDim OutputArray(0 To j) As String

    For i = 0 To j
    OutputArray(i) = InputArray(j - i)
    Next i

    ' Now we put the reversed list back together, adding the delimiter back in.
    ReverseList = Join(OutputArray(), DelimiterString)

    End Function


    You can call this in a cell with =ReverseList(A1, ":") in order to handle your example.



    While it's scary to create your first UDF, it's pretty straightforward if you follow the steps.






    share|improve this answer
























    • Dealing with the scripting in newer versions of Excel require the different file extension as well as permission settings. If this were just for me, I might be more apt to go this route. I REALLY appreciate your link though as I've tried using VBA, but couldn't get them to work (I forgot to create a module), so thank you soooo much for that link! Definitely keeping your script in mind in case I need it for something more complex!

      – BondUniverse
      Sep 26 '13 at 20:52











    • Creating a module is the secret step everyone needs to know about.

      – Dane
      Sep 26 '13 at 21:19











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f650682%2fexcel-formula-to-split-a-cell-and-reverses-the-order%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    Assuming three colons as separators try this formula



    =IF(C12="","",TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),200,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),100,100))&":"&LEFT(C12,FIND(":",C12)-1))



    Explanation:



    To get the part after the last colon I used this formula:



    =TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))



    That uses SUBSTITUTE to replace each colon with 100 spaces. As we are dealing with IP addresses each part is clearly a small number of characters so then using MID to take 100 characters starting at char 300 will include only the last part of the IP address and some spaces - TRIM then trims the spaces - I used the same approach to get the middle two parts and then LEFT function combined with FIND to get the first part






    share|improve this answer


























    • This works perfectly! Thank you!

      – BondUniverse
      Sep 26 '13 at 20:50











    • This is kinda brilliant. It took me a bit to parse it. Any chance you'd explain what you're doing?

      – Dane
      Sep 26 '13 at 21:25
















    3














    Assuming three colons as separators try this formula



    =IF(C12="","",TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),200,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),100,100))&":"&LEFT(C12,FIND(":",C12)-1))



    Explanation:



    To get the part after the last colon I used this formula:



    =TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))



    That uses SUBSTITUTE to replace each colon with 100 spaces. As we are dealing with IP addresses each part is clearly a small number of characters so then using MID to take 100 characters starting at char 300 will include only the last part of the IP address and some spaces - TRIM then trims the spaces - I used the same approach to get the middle two parts and then LEFT function combined with FIND to get the first part






    share|improve this answer


























    • This works perfectly! Thank you!

      – BondUniverse
      Sep 26 '13 at 20:50











    • This is kinda brilliant. It took me a bit to parse it. Any chance you'd explain what you're doing?

      – Dane
      Sep 26 '13 at 21:25














    3












    3








    3







    Assuming three colons as separators try this formula



    =IF(C12="","",TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),200,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),100,100))&":"&LEFT(C12,FIND(":",C12)-1))



    Explanation:



    To get the part after the last colon I used this formula:



    =TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))



    That uses SUBSTITUTE to replace each colon with 100 spaces. As we are dealing with IP addresses each part is clearly a small number of characters so then using MID to take 100 characters starting at char 300 will include only the last part of the IP address and some spaces - TRIM then trims the spaces - I used the same approach to get the middle two parts and then LEFT function combined with FIND to get the first part






    share|improve this answer















    Assuming three colons as separators try this formula



    =IF(C12="","",TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),200,100))&":"&TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),100,100))&":"&LEFT(C12,FIND(":",C12)-1))



    Explanation:



    To get the part after the last colon I used this formula:



    =TRIM(MID(SUBSTITUTE(C12,":",REPT(" ",100)),300,100))



    That uses SUBSTITUTE to replace each colon with 100 spaces. As we are dealing with IP addresses each part is clearly a small number of characters so then using MID to take 100 characters starting at char 300 will include only the last part of the IP address and some spaces - TRIM then trims the spaces - I used the same approach to get the middle two parts and then LEFT function combined with FIND to get the first part







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Sep 26 '13 at 22:03

























    answered Sep 26 '13 at 19:37









    barry houdinibarry houdini

    10k11420




    10k11420













    • This works perfectly! Thank you!

      – BondUniverse
      Sep 26 '13 at 20:50











    • This is kinda brilliant. It took me a bit to parse it. Any chance you'd explain what you're doing?

      – Dane
      Sep 26 '13 at 21:25



















    • This works perfectly! Thank you!

      – BondUniverse
      Sep 26 '13 at 20:50











    • This is kinda brilliant. It took me a bit to parse it. Any chance you'd explain what you're doing?

      – Dane
      Sep 26 '13 at 21:25

















    This works perfectly! Thank you!

    – BondUniverse
    Sep 26 '13 at 20:50





    This works perfectly! Thank you!

    – BondUniverse
    Sep 26 '13 at 20:50













    This is kinda brilliant. It took me a bit to parse it. Any chance you'd explain what you're doing?

    – Dane
    Sep 26 '13 at 21:25





    This is kinda brilliant. It took me a bit to parse it. Any chance you'd explain what you're doing?

    – Dane
    Sep 26 '13 at 21:25













    1














    Assuming it is an IP address 1.2.3.4



    dim astring as string
    dim splat() as variant

    astring = "1.2.3.4"
    splat =split(string,".")
    string=splat(3)&"."& splat(2)&"."& splat(1)&"."&splat(0)





    share|improve this answer






























      1














      Assuming it is an IP address 1.2.3.4



      dim astring as string
      dim splat() as variant

      astring = "1.2.3.4"
      splat =split(string,".")
      string=splat(3)&"."& splat(2)&"."& splat(1)&"."&splat(0)





      share|improve this answer




























        1












        1








        1







        Assuming it is an IP address 1.2.3.4



        dim astring as string
        dim splat() as variant

        astring = "1.2.3.4"
        splat =split(string,".")
        string=splat(3)&"."& splat(2)&"."& splat(1)&"."&splat(0)





        share|improve this answer















        Assuming it is an IP address 1.2.3.4



        dim astring as string
        dim splat() as variant

        astring = "1.2.3.4"
        splat =split(string,".")
        string=splat(3)&"."& splat(2)&"."& splat(1)&"."&splat(0)






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 8 at 2:33









        Scott

        15.8k113990




        15.8k113990










        answered Jan 8 at 1:40









        fredfred

        111




        111























            0














            So, there may be a way to solve this without using VBA, but here is a user-defined formula you can use to do exactly what you're asking for, as well as handle different delimiters:



            Function ReverseList(InputString As String, Optional DelimiterString As String) As String

            ' Provide a default value of "," as the delimiter.
            If Len(DelimiterString) = 0 Then
            LabelString = ","
            End If

            ' The InputArray() will contain the values, separated at the delimiter string.
            Dim InputArray() As String
            InputArray() = Split(InputString, DelimiterString)

            ' The OutputArray() will contain the values in reverse order.
            Dim i As Integer
            Dim j As Integer
            j = UBound(InputArray)
            Dim OutputArray() As String
            ReDim OutputArray(0 To j) As String

            For i = 0 To j
            OutputArray(i) = InputArray(j - i)
            Next i

            ' Now we put the reversed list back together, adding the delimiter back in.
            ReverseList = Join(OutputArray(), DelimiterString)

            End Function


            You can call this in a cell with =ReverseList(A1, ":") in order to handle your example.



            While it's scary to create your first UDF, it's pretty straightforward if you follow the steps.






            share|improve this answer
























            • Dealing with the scripting in newer versions of Excel require the different file extension as well as permission settings. If this were just for me, I might be more apt to go this route. I REALLY appreciate your link though as I've tried using VBA, but couldn't get them to work (I forgot to create a module), so thank you soooo much for that link! Definitely keeping your script in mind in case I need it for something more complex!

              – BondUniverse
              Sep 26 '13 at 20:52











            • Creating a module is the secret step everyone needs to know about.

              – Dane
              Sep 26 '13 at 21:19
















            0














            So, there may be a way to solve this without using VBA, but here is a user-defined formula you can use to do exactly what you're asking for, as well as handle different delimiters:



            Function ReverseList(InputString As String, Optional DelimiterString As String) As String

            ' Provide a default value of "," as the delimiter.
            If Len(DelimiterString) = 0 Then
            LabelString = ","
            End If

            ' The InputArray() will contain the values, separated at the delimiter string.
            Dim InputArray() As String
            InputArray() = Split(InputString, DelimiterString)

            ' The OutputArray() will contain the values in reverse order.
            Dim i As Integer
            Dim j As Integer
            j = UBound(InputArray)
            Dim OutputArray() As String
            ReDim OutputArray(0 To j) As String

            For i = 0 To j
            OutputArray(i) = InputArray(j - i)
            Next i

            ' Now we put the reversed list back together, adding the delimiter back in.
            ReverseList = Join(OutputArray(), DelimiterString)

            End Function


            You can call this in a cell with =ReverseList(A1, ":") in order to handle your example.



            While it's scary to create your first UDF, it's pretty straightforward if you follow the steps.






            share|improve this answer
























            • Dealing with the scripting in newer versions of Excel require the different file extension as well as permission settings. If this were just for me, I might be more apt to go this route. I REALLY appreciate your link though as I've tried using VBA, but couldn't get them to work (I forgot to create a module), so thank you soooo much for that link! Definitely keeping your script in mind in case I need it for something more complex!

              – BondUniverse
              Sep 26 '13 at 20:52











            • Creating a module is the secret step everyone needs to know about.

              – Dane
              Sep 26 '13 at 21:19














            0












            0








            0







            So, there may be a way to solve this without using VBA, but here is a user-defined formula you can use to do exactly what you're asking for, as well as handle different delimiters:



            Function ReverseList(InputString As String, Optional DelimiterString As String) As String

            ' Provide a default value of "," as the delimiter.
            If Len(DelimiterString) = 0 Then
            LabelString = ","
            End If

            ' The InputArray() will contain the values, separated at the delimiter string.
            Dim InputArray() As String
            InputArray() = Split(InputString, DelimiterString)

            ' The OutputArray() will contain the values in reverse order.
            Dim i As Integer
            Dim j As Integer
            j = UBound(InputArray)
            Dim OutputArray() As String
            ReDim OutputArray(0 To j) As String

            For i = 0 To j
            OutputArray(i) = InputArray(j - i)
            Next i

            ' Now we put the reversed list back together, adding the delimiter back in.
            ReverseList = Join(OutputArray(), DelimiterString)

            End Function


            You can call this in a cell with =ReverseList(A1, ":") in order to handle your example.



            While it's scary to create your first UDF, it's pretty straightforward if you follow the steps.






            share|improve this answer













            So, there may be a way to solve this without using VBA, but here is a user-defined formula you can use to do exactly what you're asking for, as well as handle different delimiters:



            Function ReverseList(InputString As String, Optional DelimiterString As String) As String

            ' Provide a default value of "," as the delimiter.
            If Len(DelimiterString) = 0 Then
            LabelString = ","
            End If

            ' The InputArray() will contain the values, separated at the delimiter string.
            Dim InputArray() As String
            InputArray() = Split(InputString, DelimiterString)

            ' The OutputArray() will contain the values in reverse order.
            Dim i As Integer
            Dim j As Integer
            j = UBound(InputArray)
            Dim OutputArray() As String
            ReDim OutputArray(0 To j) As String

            For i = 0 To j
            OutputArray(i) = InputArray(j - i)
            Next i

            ' Now we put the reversed list back together, adding the delimiter back in.
            ReverseList = Join(OutputArray(), DelimiterString)

            End Function


            You can call this in a cell with =ReverseList(A1, ":") in order to handle your example.



            While it's scary to create your first UDF, it's pretty straightforward if you follow the steps.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 26 '13 at 18:10









            DaneDane

            1,6021117




            1,6021117













            • Dealing with the scripting in newer versions of Excel require the different file extension as well as permission settings. If this were just for me, I might be more apt to go this route. I REALLY appreciate your link though as I've tried using VBA, but couldn't get them to work (I forgot to create a module), so thank you soooo much for that link! Definitely keeping your script in mind in case I need it for something more complex!

              – BondUniverse
              Sep 26 '13 at 20:52











            • Creating a module is the secret step everyone needs to know about.

              – Dane
              Sep 26 '13 at 21:19



















            • Dealing with the scripting in newer versions of Excel require the different file extension as well as permission settings. If this were just for me, I might be more apt to go this route. I REALLY appreciate your link though as I've tried using VBA, but couldn't get them to work (I forgot to create a module), so thank you soooo much for that link! Definitely keeping your script in mind in case I need it for something more complex!

              – BondUniverse
              Sep 26 '13 at 20:52











            • Creating a module is the secret step everyone needs to know about.

              – Dane
              Sep 26 '13 at 21:19

















            Dealing with the scripting in newer versions of Excel require the different file extension as well as permission settings. If this were just for me, I might be more apt to go this route. I REALLY appreciate your link though as I've tried using VBA, but couldn't get them to work (I forgot to create a module), so thank you soooo much for that link! Definitely keeping your script in mind in case I need it for something more complex!

            – BondUniverse
            Sep 26 '13 at 20:52





            Dealing with the scripting in newer versions of Excel require the different file extension as well as permission settings. If this were just for me, I might be more apt to go this route. I REALLY appreciate your link though as I've tried using VBA, but couldn't get them to work (I forgot to create a module), so thank you soooo much for that link! Definitely keeping your script in mind in case I need it for something more complex!

            – BondUniverse
            Sep 26 '13 at 20:52













            Creating a module is the secret step everyone needs to know about.

            – Dane
            Sep 26 '13 at 21:19





            Creating a module is the secret step everyone needs to know about.

            – Dane
            Sep 26 '13 at 21:19


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f650682%2fexcel-formula-to-split-a-cell-and-reverses-the-order%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Сан-Квентин

            8-я гвардейская общевойсковая армия

            Алькесар