+ Reply to Thread
Results 1 to 13 of 13

Cannot replace #Div/O error

  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Cannot replace #Div/O error

    Dear Members,
    I am using a worksheet based on which I need to make a pie chart. There are three main columns Last Serviced Date, Todays Date and Minimum Service Interval. The columns Minimum Service Interval has number 1,2,4 or is blank. The idea is to have these three values is my formula column. Maintained when difference between dates is <365, Not maintained when difference between dates > 365. What I am trying to do is put a formula which would do the following
    1.If Difference between Today's Date and Last Service Date > 365, then fill cell with Not Maintained
    2.If Difference between Today's Date and Last Service Date >365/(Minimum Service Interval), then fill cell with Not Maintained

    This is where the complications start
    In the second condition I want to be able to say if Minimum Service Interval is Blank, then use first condition, and fill cell with Not Maintained. Finally if the conditions above are not satisfied then fill cell value as maintained. I have attached an excel sheet to give some clarity
    Attached Files Attached Files
    Last edited by luckyk; 08-25-2013 at 10:14 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Cannot replace #Div/O error

    In D2, then copied down:

    =IF(OR(TODAY()-A2>365, B2=0), "Not Maintained", "Maintained")


    You don't really need column C.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-01-2012
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Cannot replace #Div/O error

    Thanks for the quick response.
    I tried using then and found a slight problem with the result. My condition 2 is not being satisfied for many values. Example in Row number 77, the last serviced date is 21/06/2013, So difference between today and that cell, should ideally be status Maintained, but with the formula [=IF(OR(TODAY()-A2>365, B2=0), "Not Maintained", "Maintained") ] it displays Not Maintained. Its not always when B2 is blank that it should display "Not maintained". Is there a way to modify this?

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Cannot replace #Div/O error

    Please try this one

    =IF(AND(B2="",TODAY()-A2<365),"MAINTAINED",IF(TODAY()-A2<365,"MAINTAINED","NOT MAINTAINED"))
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    08-01-2012
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Cannot replace #Div/O error

    Thanks this was useful. But there is a slight query here as well
    I was trying to modify the formula to do this =IF(AND(B2="",TODAY()-A2<365),"MAINTAINED",IF(AND(B2>0,TODAY()-A2<365/B2),"MAINTAINED","NOT MAINTAINED")), but it gives me a DIV/0 in few cases where Column B2 does not have a value.
    Any thoughts?
    The reason being is that the condition for maintained is that the Difference between Today() and Last Service date should be < 365/B2 (or value in Column B)
    Last edited by luckyk; 08-25-2013 at 12:14 PM.

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Cannot replace #Div/O error

    You're Welcome. Don't forget to thank those who helped by clicking on Add Reputation *

  7. #7
    Registered User
    Join Date
    08-01-2012
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Cannot replace #Div/O error

    Sorry I just edited my previous comment
    Need more advise

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Cannot replace #Div/O error

    Your modified formula gives the same results as the one that I suggested, except it creates an error as a result of the division. What do you want the formula to show instead of error?

  9. #9
    Registered User
    Join Date
    08-01-2012
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Cannot replace #Div/O error

    It seems that your modification to the formula gives the same results that mine. What is it that you want those cells to show when error?[/QUOTE]

    When I use your formula modified by me i.e [ =IF(AND(B2="",TODAY()-A2<365),"MAINTAINED",IF(AND(B2>0,TODAY()-A2<365/B2),"MAINTAINED","NOT MAINTAINED"))], it throws an error message #DIV/0!. Check rows 58 onwards after you enter the formula mentioned here.


    PS: Sorry, for some reason I am not able to click on reply in your previous message.

  10. #10
    Registered User
    Join Date
    08-01-2012
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Cannot replace #Div/O error

    In any case if difference between today and last service date is more than 365/ Column B it should display Not Maintained

  11. #11
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Cannot replace #Div/O error

    Since you using Excel 2003 version this:

    =IF(ISERROR(IF(AND(B2="",TODAY()-A2<365),"MAINTAINED",IF(AND(B2>0,TODAY()-A2<365/B2),"MAINTAINED","NOT MAINTAINED"))),"NOT MAINTAINED",IF(AND(B2="",TODAY()-A2<365),"MAINTAINED",IF(AND(B2>0,TODAY()-A2<365/B2),"MAINTAINED","NOT MAINTAINED")))

    But please notice that division is not necessary to get the same result.

  12. #12
    Registered User
    Join Date
    08-01-2012
    Location
    London,England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Cannot replace #Div/O error

    I just added this to the previous code. Seems to have worked

    =IF(AND(B2="",TODAY()-A2<365),"MAINTAINED",IF(AND(B2="",TODAY()-A2>365),"NOT MAINTAINED",IF(AND(B2>0,TODAY()-A2<365/B2),"MAINTAINED","NOT MAINTAINED")))

  13. #13
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Cannot replace #Div/O error

    Or even this:

    =IF(B2<>"",IF(TODAY()-A2<365/B2,"Maintained","Not Maintained"),IF(TODAY()-A2<365,"Maintained","Not Maintained"))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Error 400 - Search and Replace
    By alokie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2011, 06:58 PM
  2. Replace #value! error with 0
    By dgc1952 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-05-2008, 01:18 PM
  3. Error Message When Using Replace
    By Susan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-07-2006, 10:10 AM
  4. Replies: 3
    Last Post: 10-24-2005, 01:05 PM
  5. [SOLVED] Replace debug error box
    By davegb in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-13-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1