Results 1 to 5 of 5
  1. #1
    gmccray's Avatar
    gmccray is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    11

    Replacing #Num! error with a zero


    SELECT OperatorID, Sum(AppsChecked) AS TotAppsChecked, Sum((AppsChecked)-(AppErrors)) AS TotAppsCorrect, Format((TotAppsCorrect)/(TotAppsChecked), "Percent") AS PctCorrect, Sum(AppErrors) AS TotAppErrors, Format((TotAppErrors)/(TotAppsChecked), "Percent") AS PctErrors
    FROM Stats
    WHERE (((Stats.OperatorId)=[Enter OperatorID]) AND ((Stats.Date) Between [Enter Start Date] And [Enter End Date]))
    GROUP BY OperatorId;


    Hello All,
    I am trying to replace a #Num! error with a zero (0). It is the product of division by zero when trying calculate a percentage. The code I am using is above. Can you help?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    In general:

    IIf(B = 0, 0, A/B)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    gmccray's Avatar
    gmccray is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    11
    I'm afraid I am not that advanced yet, can you give me a more descriptive example using the code I supplied? I really appreciate your kind assistance!

  4. #4
    gmccray's Avatar
    gmccray is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    11
    Tried it, got it! Thanks!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help! Thought you might get it if you tried.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replacing expression in table using VBA
    By alex1888 in forum Programming
    Replies: 5
    Last Post: 06-03-2015, 09:12 AM
  2. Replacing one value for another
    By Richiebob in forum Programming
    Replies: 10
    Last Post: 05-06-2013, 11:33 AM
  3. Replacing space with dot
    By JeroenMioch in forum Programming
    Replies: 15
    Last Post: 10-22-2012, 07:09 AM
  4. Replacing text for a report
    By Zaram in forum Reports
    Replies: 7
    Last Post: 02-23-2010, 12:27 PM
  5. Replacing Null with 0
    By gilagain1 in forum Queries
    Replies: 5
    Last Post: 04-23-2009, 01:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums