Add IFERROR to formula

Hello,

I have a tricky formula question. If I want to add a IFERROR to the following formula where would I go about inserting it?


=(((IF(LEFT([End Time (HH:MM)]@row, FIND(":", [End Time (HH:MM)]@row) - 1) = "12", IF(OR(FIND("a", [End Time (HH:MM)]@row) > 0, FIND("p", [End Time (HH:MM)]@row) > 0), 0, 12), VALUE(LEFT([End Time (HH:MM)]@row, FIND(":", [End Time (HH:MM)]@row) - 1))) + IF(FIND("p", [End Time (HH:MM)]@row) > 0, 12)) * 60 + VALUE(MID([End Time (HH:MM)]@row, FIND(":", [End Time (HH:MM)]@row) + 1, 2))) - ((IF(LEFT([Start Time (HH:MM)]@row, FIND(":", [Start Time (HH:MM)]@row) - 1) = "12", IF(OR(FIND("a", [Start Time (HH:MM)]@row) > 0, FIND("p", [Start Time (HH:MM)]@row) > 0), 0, 12), VALUE(LEFT([Start Time (HH:MM)]@row, FIND(":", [Start Time (HH:MM)]@row) - 1))) + IF(FIND("p", [Start Time (HH:MM)]@row) > 0, 12)) * 60 + VALUE(MID([Start Time (HH:MM)]@row, FIND(":", [Start Time (HH:MM)]@row) + 1, 2)))) / 60

Tags:

Best Answer

Answers

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    It depends on what exactly you are wanting to accomplish. If you are just trying to output (for example) a blank when the formula generates an error, you would wrap the whole thing in the IFERROR:

    =IFERROR(original_formula, "")

  • Katye Reed
    Katye Reed ✭✭✭✭✭

    That's exactly what I am looking to do but get an unparseable error.


    =IFERROR(((IF(LEFT([End Time (HH:MM)]@row, FIND(":", [End Time (HH:MM)]@row) - 1) = "12", IF(OR(FIND("a", [End Time (HH:MM)]@row) > 0, FIND("p", [End Time (HH:MM)]@row) > 0), 0, 12), VALUE(LEFT([End Time (HH:MM)]@row, FIND(":", [End Time (HH:MM)]@row) - 1))) + IF(FIND("p", [End Time (HH:MM)]@row) > 0, 12)) * 60 + VALUE(MID([End Time (HH:MM)]@row, FIND(":", [End Time (HH:MM)]@row) + 1, 2))) - ((IF(LEFT([Start Time (HH:MM)]@row, FIND(":", [Start Time (HH:MM)]@row) - 1) = "12", IF(OR(FIND("a", [Start Time (HH:MM)]@row) > 0, FIND("p", [Start Time (HH:MM)]@row) > 0), 0, 12), VALUE(LEFT([Start Time (HH:MM)]@row, FIND(":", [Start Time (HH:MM)]@row) - 1))) + IF(FIND("p", [Start Time (HH:MM)]@row) > 0, 12)) * 60 + VALUE(MID([Start Time (HH:MM)]@row, FIND(":", [Start Time (HH:MM)]@row) + 1, 2)))),"") / 60, "")

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Looks like you may be missing an opening parenthesis at the beginning. Tyr this...

    =IFERROR((((IF(LEFT([End Time (HH:MM)]@row, FIND(":", [End Time (HH:MM)]@row) - 1) = "12", IF(OR(FIND("a", [End Time (HH:MM)]@row) > 0, FIND("p", [End Time (HH:MM)]@row) > 0), 0, 12), VALUE(LEFT([End Time (HH:MM)]@row, FIND(":", [End Time (HH:MM)]@row) - 1))) + IF(FIND("p", [End Time (HH:MM)]@row) > 0, 12)) * 60 + VALUE(MID([End Time (HH:MM)]@row, FIND(":", [End Time (HH:MM)]@row) + 1, 2))) - ((IF(LEFT([Start Time (HH:MM)]@row, FIND(":", [Start Time (HH:MM)]@row) - 1) = "12", IF(OR(FIND("a", [Start Time (HH:MM)]@row) > 0, FIND("p", [Start Time (HH:MM)]@row) > 0), 0, 12), VALUE(LEFT([Start Time (HH:MM)]@row, FIND(":", [Start Time (HH:MM)]@row) - 1))) + IF(FIND("p", [Start Time (HH:MM)]@row) > 0, 12)) * 60 + VALUE(MID([Start Time (HH:MM)]@row, FIND(":", [Start Time (HH:MM)]@row) + 1, 2)))) / 60, "")

  • Katye Reed
    Katye Reed ✭✭✭✭✭

    Worked like a charm! It's always those parens that get me. Thank you so much, Paul!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!