queries- how to query data that meets a condition in FieldA OR another condition in FieldB

analys919

New Member
Joined
Oct 22, 2008
Messages
4
I want to run a query that gives results where EITHER
1.) field A is not blank (Is not null)
or
2.) field B is not blank

i know how to return results where BOTH conditions are true, but i do not know how to query so that all results are returned where one or the other criteria are true.

please help!

thanks
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Welcome to the Board!

I assume that you are entering these criteria in Query Builder (if you were writing it in SQL code directly, you would just use OR).

In order to get the OR instead of AND in Query Builder, simply put these two criteria in different criteria rows. When the criteria under multiple fields are on the same line, it is treated as AND. When they are on different lines, they are treated as OR.
 
Upvote 0

Forum statistics

Threads
1,215,560
Messages
6,125,527
Members
449,236
Latest member
Afua

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