Friday, May 27, 2011

Excel and IP addresses

It seems I am frustrated by Excel's inability to handle IP addresses natively.  Eventually, i should write some global formulas mimicing inet_ntoa() and inet_aton() from MySQL.  In the mean time, I've been creating the formulas manually to slice and dice IP addresses.  It's not actually too hard, as long as you're not scared by long formulas.  I usually build this formula in pieces then consolidate them down to one (I should write a procedure that would do that automatically).  Eventually...

Anyway, the formula is this:

You can put this formula into any cell and it will take the IP address in cell A1 and convert it to decimal.  The nice thing about this is that you can apply this formula to a list of IP addresses then use it to sort the IP addresses.  That way comes after

See part 2 of this post here.