Hi, people,
First... for this problem... some definitions...
An IP ADDRESS is something like 111.22.33.44.
An IP NUMBER is the same thing, converted to a sortable number, usually with 10 digits.
A certain website gives me a bunch of IP Numbers.
I need to convert them back to IP Addresses.
The website gives me the PERL formulas...
To convert an IP address to an IP number...
ipnum = 16777216*w + 65536*x + 256*y + z
where
IP Address = w.x.y.z
The reverse of this formula is
w = int ( ipnum / 16777216 ) % 256;
x = int ( ipnum / 65536 ) % 256;
y = int ( ipnum / 256 ) % 256;
z = int ( ipnum ) % 256;
Where % is the mod operator.
and
To convert an IP number to an IP address...
sub numToStr {
my ($ipnum) = @_;
my $z = $ipnum % 256;
$ipnum >>= 8;
my $y = $ipnum % 256;
$ipnum >>= 8;
my $x = $ipnum % 256;
$ipnum >>= 8;
my $w = $ipnum % 256;
return "$w.$x.$y.$z";
}
I don't know Perl, or what "mod operator" means.
What's the Excel formula that I can put in cell B2...
to convert the IP Number in A2 to an IP Address?
Thanks, in advance.
Mark53
Bookmarks