Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MS-Access
i have a table called info with 3 fields namely;
Name   totalvisits   specialvisits
mmm    30            15
kkk    49            49
jjj    60            30
mu     40            -99
jh     -99           -99
 
-99 denotes missing values, I want to calculate percentage of specialvisits to totalvisits. here is what my expression in ms access;
 
percentage special visit:[info].[specialvisits]/[info].[totalvisits]*100
 
It is giving me the correct answers for all values where there no missing data.how will my expression be like so that it disregard the missing values.
Posted 13-Aug-12 0:51am
mayeso644
Edited 13-Aug-12 0:54am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use WHERE statement in your query:
SELECT [Name], [totalvisits], [specialvisits],  [totalvisits]/[specialvisits] * 100 AS Percentage
FROM info
WHERE  ([totalvisits]>0) AND ([specialvisits]>0);
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,192
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 15 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100