• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

One for the Excel experts

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    One for the Excel experts

    Got a spreadsheet full of IP addresses that someone before me ordered by ascending numbers. Unfortunately instead of looking like:

    192.168.0.1
    192.168.0.2
    192.168.0.3
    192.168.0.4
    192.168.0.5
    etc etc

    It's ordered it like this:

    172.17.90.1
    172.17.90.10
    172.17.90.100
    172.17.90.101
    172.17.90.102
    172.17.90.103
    172.17.90.104
    172.17.90.105
    172.17.90.106
    172.17.90.107
    172.17.90.108
    172.17.90.109
    172.17.90.11
    172.17.90.110
    172.17.90.111
    172.17.90.112

    Any ideas how to order it differently so it lists the addresses in chronological order? I've tried changing the format of the number and there's no option for IP addresses..

    Thanks in advance
    "Is someone you don't like allowed to say something you don't like? If that is the case then we have free speech."- Elon Musk

    #2
    Copy-n-paste IPs into Notepad. Use Ctrl-H to change all dots to commas.
    Save as xxx.csv
    Open xxx.csv in Excel
    Create new column, and set it to ColA & "." & ColB & "." & ColC. Drag-n-copy down the page. Copy and Paste Special as Values.
    Delete original Cols A, B & C.
    You now have new Col A, which is a list of IPs without the last octet. That's in Col B.
    Select entire page, sort by ColA/ColB.
    In an empty Col, set it to be ColA & "." & ColB. Drag-n-copy down the page. Copy and Paste Special as Values.

    Et, voila!
    Last edited by richard-af; 24 August 2007, 18:12.

    Comment


      #3
      legend
      "Is someone you don't like allowed to say something you don't like? If that is the case then we have free speech."- Elon Musk

      Comment


        #4
        You need to remove the dots and pad the numeric value to 10 digits
        and convert to a number. stick this formula below in another column
        where A1 = start of IP addresses. then sort by this column.

        =VALUE(LEFT((SUBSTITUTE(A1,".",""))&REPT("0",10),1 0))

        Comment


          #5
          I'd use a left join.

          Comment


            #6
            Originally posted by Bright Spark View Post
            You need to remove the dots and pad the numeric value to 10 digits
            and convert to a number. stick this formula below in another column
            where A1 = start of IP addresses. then sort by this column.

            =VALUE(LEFT((SUBSTITUTE(A1,".",""))&REPT("0",10),1 0))
            That won't work unless the only difference between the IP adresses is in the 4th part. If that's the case then it's good enough, but you might need to sort on more than 10 digits.

            Edit: looks it won't work at all

            If you only need to sort those addresses once, then the cvs file solution is probably the easiest. But if you want to make it automatic, you will most likely have to write some VBA code.
            Last edited by bored; 24 August 2007, 17:57.

            Comment


              #7
              Originally posted by DimPrawn View Post
              I'd use a left join.
              You are very naughty.

              Comment


                #8
                Originally posted by Jog On View Post
                Any ideas how to order it differently so it lists the addresses in chronological order? I've tried changing the format of the number and there's no option for IP addresses..

                Thanks in advance
                you want them in date order?

                ,... pedantically yours.....

                Comment


                  #9
                  Originally posted by robnjc View Post
                  you want them in date order?

                  ,... pedantically yours.....
                  One has to second-guess the challenged User!

                  Comment


                    #10
                    Originally posted by robnjc View Post
                    you want them in date order?

                    ,... pedantically yours.....
                    <pedant>
                    Surely you mean numerical order as opposed to lexicographic order?
                    </pedant>

                    Comment

                    Working...
                    X