Chat with a LIVE Microsoft Access Expert!
 
       
 

         

   

Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
 
Chat with a LIVE Microsoft Access Expert!
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-11-2006, 09:59 AM
profxavier27809 profxavier27809 is offline
Registered User
 
Join Date: Sep 2005
Posts: 11
profxavier27809 is on a distinguished road
Countif

Hey there,

Is there a quick expression to put in the control source area of a field on a report that says COUNTIF([Sample Text Field] = "NO")

I would like it to only count the occurrences of NO.
Reply With Quote
Sponsored Links
  #2  
Old 01-12-2006, 01:18 AM
reclusivemonkey's Avatar
reclusivemonkey reclusivemonkey is offline
Registered User
 
Join Date: Oct 2004
Location: West Yorkshire, U.K.
Posts: 749
reclusivemonkey is on a distinguished road
There is no COUNTIF in access, but you could put a field on your report which has

Code:
IIF([Sample Text Field]="NO",1,0)
make it invisible, then just use COUNT to get the number of occurences.
Reply With Quote
  #3  
Old 01-12-2006, 04:37 AM
Rich
Guest
 
Posts: n/a
=Sum(Iif([YourField]=No,1,0))
Reply With Quote
  #4  
Old 06-29-2009, 01:46 PM
jsparker jsparker is offline
Sr. Data Technician
 
Join Date: Jun 2008
Location: Birmingham, AL
Posts: 24
jsparker is on a distinguished road
Send a message via AIM to jsparker Send a message via Yahoo to jsparker
Re: Countif

Quote:
Originally Posted by reclusivemonkey View Post
There is no COUNTIF in access, but you could put a field on your report which has

Code:
IIF([Sample Text Field]="NO",1,0)
make it invisible, then just use COUNT to get the number of occurences.
I understand how to make the above text box invisible. My field is called [Error Count] but when I try to add another field to COUNT[Error Count] it isn't recognizing the field and zeroing it out when I run the report. I must be missing something.

Help?
Reply With Quote
  #5  
Old 06-29-2009, 08:03 PM
Galaxiom Galaxiom is offline
Registered User
 
Join Date: Jan 2009
Location: NSW Australia
Posts: 1,446
Galaxiom will become famous soon enough
Re: Countif

Although the new text box with the IIF statement will show the result for each record you cannot perform Totals calculations on the box.
Totals are performed on fields in the Record Source.

You need to add the IIF expression as a field in the Record Source query of your report.

Also you will want to SUM the [Error Count] field to get the total of "NO" values.
COUNT will just give you the total number of records regardless of their value.

You do not need to include the [Error Count] textbox on the report at all.
It just needs to be a field in the Record Source.
Reply With Quote
  #6  
Old 06-30-2009, 06:16 AM
jsparker jsparker is offline
Sr. Data Technician
 
Join Date: Jun 2008
Location: Birmingham, AL
Posts: 24
jsparker is on a distinguished road
Send a message via AIM to jsparker Send a message via Yahoo to jsparker
Re: Countif

Thanks Galaxiom. That was my issue. I kept trying to sum at report level and it was giving an error message. Once I plugged in the formula at the record source level and then just summed at report level it worked perfectly. Thanks again.
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Equivalent to Excel's COUNTIF function?? CliffHanger9 General 4 01-06-2005 10:32 AM
Counting records using SQL and writing to a table. TheTrainMan Modules & VBA 9 09-02-2004 04:50 AM
Is there an Excel CountIf Function in Access jonnymac1979 General 8 09-01-2004 12:17 AM
COUNTIF - Quite urgent morlan General 2 05-13-2003 08:40 AM
CountIf function AnnPhil Reports 1 06-09-2002 09:21 PM


All times are GMT -8. The time now is 09:38 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) copyright 2009 Access World