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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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