Kind of like Data Validation

Todd Bardoni

Well-known Member
Joined
Aug 29, 2002
Messages
3,042
What I'm looking to do is this:
I want to limit a column to only accept IP Addresses. So, for example, I want the column to only accept data between:

1.1.1.1 and 999.999.999.999

I can't do this with Data Validation (as far as I know). Anybody have any ideas?
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

IML

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,743
I don't know IP address but a custom validation of
=AND((LEN(A1)-LEN(SUBSTITUTE(A1,".","")))=2,ISNUMBER(SUBSTITUTE(A1,".","")+0))

for cell A1 will ensure you only numbers and two decimal places. Of course, validation doesn't work for items pasted in, and it this would seem to something people would want to paste in.
 

Todd Bardoni

Well-known Member
Joined
Aug 29, 2002
Messages
3,042

ADVERTISEMENT

Actually this will work if I could get one more decimal point in there instead of three that it will allow me. Any help?
 

Todd Bardoni

Well-known Member
Joined
Aug 29, 2002
Messages
3,042
The above formula only allows for two decimals...I need three...Can anyone help? I hate to keep asking, but I'm so close yet so far.....
 

IML

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,743
=AND((LEN(A1)-LEN(SUBSTITUTE(A1,".","")))=3,ISNUMBER(SUBSTITUTE(A1,".","")+0))

will allow for only 3 decimals.

As I said, this isn't perfect, it allows for things such as
99.99..999

It would,however, be easy to limit this to list a valid IPs, if such a list exists for your purposes.
 

geogherkins

New Member
Joined
Oct 24, 2012
Messages
1
=AND((LEN(A1)-LEN(SUBSTITUTE(A1,".","")))=3,ISNUMBER(SUBSTITUTE(A1,".","")+0))



Thank you for this forumula. It was just what I was looking for to help contain typographical errors in a spreadsheet being used by non-technical data entry!
 

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,328
Members
414,054
Latest member
Sameer50

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top