Solved

Query filter

Posted on 2014-11-13
2
176 Views
Last Modified: 2014-11-13
Experts:

I haven't used Access for a while so I'm a bit "rusty" on query filters.

Please find attached 2 documents:
1. QueryCalculation.mdb
2. Calculation.xls

The database contains one Table and two queries.    The spreadsheet mimics the value set in Table1.

In the two Access queries, I'm trying to calculate the average values for the four records BUT MUST EXCLUDE any records where value = 999.

The difference between query 1 and query 2 is where I placed the filter "< > 999" ("and" vs. "or").

The XLS provides the correct average values.   That is, I've manually excluded the 999 values in the average calculation.

My question:   How I can get same four average values (as shown in XLS) in an MS-Access query?

Thanks,
EEH
QueryCalculation.accdb
Calculation.xlsx
0
Comment
Question by:ExpExchHelp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40441055
try this query


SELECT Avg(IIf([Field1]=999,Null,[Field1])) AS Expr1, Avg(IIf([Field2]=999,Null,[Field2])) AS Expr2, Avg(IIf([Field3]=999,Null,[Field3])) AS Expr3, Avg(IIf([Field4]=999,Null,[Field4])) AS Expr4
FROM Table1;
0
 

Author Closing Comment

by:ExpExchHelp
ID: 40441804
Perfect solution!!  Thank you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question