delete query with more than 1 criteria not to delete

afs24

Board Regular
Joined
Sep 26, 2002
Messages
237
I creating a delete query but do not want to delete certain entries. Im trying to delete the event feild except for three entries. This is what the feild and criteria looks like. What else could I do?

EVENTS
front loading
home sale
50% off sale
shoe sale

crieteria: not "front loading" or not "home sale" or not "50% off sale"

this is not working or me.....It deletes everything....I can only make one crieteria selection for it to work.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try putting each criteria on a separate criteria line in the Query Builder:
Code:
NOT "front loading"
        or
NOT "home sale"
        or
NOT "50% off sale"
 
Upvote 0
Oh, wait, instead of:
not "front loading" or not "home sale" or not "50% off sale"
try:
Code:
not "front loading" AND not "home sale" AND not "50% off sale"
Note: "Or" and "And" in SQL is counter-intuitive. They way you use these words in normal speech and the way they are used in SQL is exactly the opposite!
 
Upvote 0
You could try another syntax:

Not In("front loading","home sale","50% off sale")

This often simplifies the logic (for me, anyway)
 
Upvote 0

Forum statistics

Threads
1,221,551
Messages
6,160,460
Members
451,648
Latest member
SuziMacca

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