Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in


How to pad IP address with zero in Excel?

When receiving a sheet which contains some IP addresses with two digits in some segments, you may want to pad the IP address with zero to three digits in every segment as below screenshot shown. In this article, I introduce some tricks to quickly pad IP address in Excel.
doc pad ip with zero 1

Pad IP address with zero by formula

Pad IP address with zero by Defined Function

Pad IP address with zero by formula

Here is a long formula that can help you quickly pad IP address with zero.

Select a blank cell, type this formula,


A1 is the IP address you use, press Enter key, drag fill handle down to the cells needed this formula. see screenshot:

doc pad ip with zero 2
doc arrow down
doc pad ip with zero 3

Pad IP address with zero by Defined Function

If you are familiar with VBA code, here is a code that can also help you to pad IP address.

1. Press Alt + F11 keys to enable Microsoft Visual Basic for Applications window, click Insert > Module to create a new module. See screenshot:
doc pad ip with zero 4

2. In the Module script, paste below code to it, and then save the code and close the VBA window. See screenshot:

VBA: Pad IP Address

Function IP(Txt As String) As String
    Dim xList As Variant
    Dim I As Long
    xList = Split(Txt, ".")
    For I = LBound(xList) To UBound(xList)
        xList(I) = Format(xList(I), "000")
    IP = Join(xList, ".")
End Function

doc pad ip with zero 5

3. Go to a blank cell which you will place the calculated result, type this formula =IP(A1), press Enter key, and drag fill handle down to the cells you need. See screenshot:

doc pad ip with zero 6 shot arrow right doc pad ip with zero 7


Exctract Email Address 

Kutools for Excel's Extract Email Address utility can quickly extract all email addresses from text strings to another location.
doc extract email address

Relative Articles

Recommended Productivity Tools for Excel

kte tab 201905

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.