Click here to Skip to main content
13,088,711 members (53,333 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 12-Aug-12 23:51pm
Updated 12-Aug-12 23:54pm

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 |
Web03 | 2.8.170813.1 | Last Updated 15 Apr 2013
Copyright © CodeProject, 1999-2017
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