Criteria for a query with an input mask

Liv064

New Member
Joined
Sep 7, 2004
Messages
4
I am doing a query on a table with a field called phone number. The input mask on the field makes it look like (123) 456-7890, I want the query to give me all results that don't begin with (123), so my criteria is
not like "(123)*" but it doesn't seem to work. I think the brackets are causing problems, any ideas?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
What if you just try:
Not Like "123*"
 
Upvote 0
That is exactly what I did, my only concern is the 123 can show up in other parts of the phone number not just the beginning but it did work. Does that mean that because the input mask adds the () do they exist in the data?
 
Upvote 0
It should work out the way you want.

First, you are correct in saying that the "(" and ")" only appear in the mask and are not part of the actual data. That is why "123*" works and "(123)*" doesn't.

Second, you shouldn't have any problems accidentally picking up numbers with "123" in the middle of the phone number. The "*" is a wildcard, so:
"123*" only picks up numbers that begin with "123",
"*123" only picks up numbers that end with "123", and
"*123*" would pick up numbers that have "123" anywhere in them.
 
Upvote 0

Forum statistics

Threads
1,221,816
Messages
6,162,149
Members
451,746
Latest member
samwalrus

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