Filter ID by "."

philgarside

Board Regular
Joined
Mar 31, 2005
Messages
86
Hi all,

Any help with this would be appreciated. I have a field in my query call Id; it’s our reference id for jobs being worked on. However we have a number of duplicates that have been imported in error. These error id’s contain a decimal place in the code and I wanted to know if it would be possible to filter these out in my query.

ID
12494245
714023
692159
707177
691188
708161
694876
694876
10817399
12469813
1.2469
12501075
12495731
1.2369
12369493
12501898
12399664
11979428
712805
720276


Thanks for your help,

Phil
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi

Assuming that your ID field is text then you could use something like this:

SELECT MYTABLE.ID
FROM MYTABLE
WHERE Clng(InStr(1,[MYTABLE]![ID],'.'))=0

Obviously you'll need to change the table and field names. It will basically pull any records where there is no full stop/period in the ID field.

HTH
DK
 
Upvote 0
Glad to hear it. Just to say, you would probably be better off using the slightly changed version that Bob suggested - using the Clng was an oversight on my part and will actually result in the query running slower (approximately half the speed based on testing I did on 600,000 records). If your table is small (e.g. few thousand rows) then the speed difference may be negligible although it's always best to use the quickest query possible as that will allow for further growth and ensure that your application is as responsive as possible.

Cheers
DK
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,459
Members
452,915
Latest member
hannnahheileen

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