A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Use
=MID(A1,FIND("~",SUBSTITUTE(A1,".","~",3))+1,3)
instead.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I need to list the last octet of an IP address in one column of excel.
If A1 has the IP address, I would like A2 to show the last octet of the IP address in A1.
I tried this, but when the last octet was only 2 digits, it gave me .xx instead of just xx. It would probably do similar when the last octet is 1 digit.
=RIGHT(A1,FIND("~",SUBSTITUTE(A1,".","~",1)))
Thanks.
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Use
=MID(A1,FIND("~",SUBSTITUTE(A1,".","~",3))+1,3)
instead.
Answer accepted by question author
Or Try this one:
=RIGHT(SUBSTITUTE(A1,".","~",3),LEN(SUBSTITUTE(A1,".","~",3))-FIND("~",SUBSTITUTE(A1,".","~",3)))
Use this one.
=RIGHT(A1,LEN(A1)-FIND("~",SUBSTITUTE(A1,".","~",3)))
OR
=MID(A1,FIND("~",SUBSTITUTE(A1,".","~",3))+1,3)
Hi,
Try this
=TRIM(RIGHT(SUBSTITUTE(A1,".",REPT(" ",256)),256))
Thanks for the feedback. I realized later I could shorten my offering just a little and uncomplicated it a bit:
=RIGHT(SUBSTITUTE(A1,".","~",3),LEN(A1)-FIND("~",SUBSTITUTE(A1,".","~",3)))
And since if there is no entry in A1 or if it is not a properly entered IP address it will return an error, you can cover the error this way:
=IFERROR(RIGHT(SUBSTITUTE(A1,".","~",3),LEN(A1)-FIND("~",SUBSTITUTE(A1,".","~",3))),"Not a valid IP")