Results 1 to 8 of 8
  1. #1
    Joshwenny is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2018
    Posts
    11

    Query #NUM!


    I have a calculated row in a table that when no values are there to be calculated, displays a #num!. Is there a way to make that cell just be blank "Null" when there are no values to calculate. The reason its an issue is that I cannot create a totals query for that row because of the #NUM!. I want to be able to average that row using a query but cannot because of the #num! error that is displayed in the row. Any help is much appreciated. Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What is the expression?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Joshwenny is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2018
    Posts
    11
    I should state that the #num! is coming from dividing by zero. I have a calculation that counts any yes statements as 1 and any no statements as 1 and then I use a calculation to find the percentage of questions answered correctly. [Question 5 Correct]/([Question 5 Correct]+[Question 5 Incorrect]) When both the yes and no rows are zero, I get a #num! error. How can I prevent this so that way I can use a totals query to average that column? It will not let me do that with rows that have a #num!. I need a way to somehow say, when both Question 5 Correct] & [Question 5 Incorrect]) are zero, then show as null. Is this possible?

  4. #4
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,742
    Let's try again. WHAT is the code causing the trouble? Not a description of what you want the code to do, but the CODE ITSELF. How do you expect us to debug code that you refuse to show?

    EDIT: Josh, just notice how close together the timing is in the posts. Maybe I jumped the gun on you, as you may not have yet seen post #2 when you sent post #3
    Last edited by davegri; 07-25-2018 at 09:16 PM. Reason: apology

  5. #5
    Joshwenny is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2018
    Posts
    11
    I guess I'm unsure of what code you mean? I don't think there is code "SQL" for tables. Are you needing the error message that pops up when I try to run the query? The query is a totals query that is trying to average a row that contains a few #num! values. Those #num! values are what i'm trying to have changed to null values.

  6. #6
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,742
    I have a calculated row in a table that when no values are there to be calculated, displays a #num!.
    Those #num! values are what i'm trying to have changed to null values.
    Yes, and what calculations/code is causing the #num values? Where are the fields involved in the calculations coming from? Give us something to work with.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    [Question 5 Correct]/IIf([Question 5 Correct]+[Question 5 Incorrect] = 0, 1, [Question 5 Correct]+[Question 5 Incorrect])
    Last edited by June7; 07-26-2018 at 12:10 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Joshwenny is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2018
    Posts
    11
    June7, THANK YOU!!!!!!! Your equation worked great. I changed the equation to use null instead of 1 and viola! [Question 5 Correct]/IIf([Question 5 Correct]+[Question 5 Incorrect]=0,Null,[Question 5 Correct]+[Question 5 Incorrect]) Both you and Davegri, thank you!

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

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