Solved

# Count Boolean Values

Posted on 2011-05-09
Medium Priority
722 Views
Good afternoon!

I have a table that contains the following (Note; only one table no links to other tables)
I need to count the number of records that have the field NoValidAddress = Yes
(boolean, yes if not valid address, no if a valid address).  No matter what I try, I count all of the records in the table - any help would be great appreciated!

Thanks very much,
Colleen Slater
0
Question by:rporter45
• 2
• 2

LVL 101

Accepted Solution

mlmcc earned 1000 total points
ID: 35722121
Try this

Add a formula to the report
If {BooleanField} then
1
Else
0

Put it in the details section
Right click it
CLick INSERT --> SUMMARY
Choose type as SUM
Put it in the appropriate footer

You can delete the formula from the details section

mlmcc
0

Author Comment

ID: 35722836
Fantastic!  It worked perfectly - If you do have a moment, can you please explain the logic?  From my limited perspective on Crystal, the field values were already 1 and 0 but we declare the same again.

Thanks very much!

cms
0

LVL 101

Expert Comment

ID: 35722965
As far as Crystal is concerned the values are TRUE and FALSE which arent numeric.  The IF provides the values 1 and 0 so the sum can be done.

If you need to count the false values
If  NOT {BooleanField} then
1
Else
0

mlmcc
0

Author Comment

ID: 35723198
Sounds extremely sensible now that you have explained!  Thank you for this,

cms
0

## Featured Post

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
###### Suggested Courses
Course of the Month17 days, 8 hours left to enroll