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?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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.
 
Upvote 0
Actually this will work if I could get one more decimal point in there instead of three that it will allow me. Any help?
 
Upvote 0
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.....
 
Upvote 0
=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.
 
Upvote 0
=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!
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,720
Members
448,986
Latest member
andreguerra

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
Back
Top