Results 1 to 3 of 3
  1. #1
    Tia2021 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    12

    Correct a #num and #div/0 in the same code

    Hi All,



    I am getting an error when i calculate 2 cell. Depending on the values its working with i get either #Num! or #Div/0!, Is there anyway to correct this within the calculation to just return zero?

    My Calculation is JTD: [RevSpendtoDate]/[SpendtoDate] so below are the values that cause it:

    0/0 = #Num!
    144/0 = #Div/0!

    I understand why I'm getting it and that it is correct based on what I'm trying to do but i need 0 to be the result instead of the #num and div

    Appreciate any help possible

    Treacy

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Try:
    JTD:Iif([SpendtoDate] = 0, 0,[RevSpendtoDate]/[SpendtoDate])
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Tia2021 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    12
    That worked perfectly, thanks a mil Bob

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

Similar Threads

  1. Is this Code Correct?
    By cdixon102419607 in forum Programming
    Replies: 14
    Last Post: 08-19-2017, 11:11 AM
  2. Help with VBA code to correct bad data
    By Processor in forum Programming
    Replies: 3
    Last Post: 07-09-2017, 07:01 PM
  3. IS this code correct?
    By Jen0dorf in forum Queries
    Replies: 1
    Last Post: 10-24-2015, 04:23 PM
  4. code to determine correct dimensions
    By mbar in forum Programming
    Replies: 3
    Last Post: 05-03-2012, 04:27 PM
  5. Correct code for challenging dates?
    By thekruser in forum Queries
    Replies: 6
    Last Post: 11-08-2010, 03:38 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