Solved

Query filter

Posted on 2014-11-13
2
184 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

636 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