Click here to Skip to main content
11,929,249 members (64,968 online)
Rate this:
Please Sign up or sign in to vote.
See more: 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 will my expression be like so that it disregard the missing values.
Posted 13-Aug-12 0:51am
Edited 13-Aug-12 0:54am

1 solution

Rate this: bad
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);

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 15 Apr 2013
Copyright © CodeProject, 1999-2015
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