not or <> "string" problems

dunnes

Board Regular
Joined
May 21, 2003
Messages
69
hello,
im currently using a query which doesnt want to include a certain string ie Lead. the column that i do this criteria search on has many other strings and empty strings, so when i use the criteria not "Lead" or <> "Lead" the filter seems to work but also filters away the blank strings..... is there any other way to filter out the string lead which doesnt also filter out the blank entries????



Cheers
Mike
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi Mike
Prefix your criteria with "Is Null Or" (without the quotes)
HTH, Andrew. :)
 
Upvote 0
genius andrew..... still a bit fluxed with the logic but aslong as it works thats fine with me

Cheers
Mike
 
Upvote 0
Hi Mike

The logic works such that provided either of the following conditions are met, then display the record :

condition 1 : Is Null (this selects all records where the string is empty)

condition 2 : <>"Lead" (this selects all records where the string does not equal "Lead").

We have to use an Or (instead of an And) because a string can not be null and not equal to something simultaneously - I realise that is 'double speak' because if a field is null then it definitely does not equal something else - but if something is 'null' then there is nothing to compare to the criteria. To summarise : criteria in queries does not work with null records.

Hopefully that isn't adding to the confusion.

Andrew :)

P.S. I haven't explained that very well but this article might help.
 
Upvote 0

Forum statistics

Threads
1,221,860
Messages
6,162,479
Members
451,769
Latest member
adyapratama

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