Math equation within a IF formula??

Options
Sean Huynh
Sean Huynh ✭✭
edited 09/03/20 in Formulas and Functions

Good afternoon community,

I have a simple formula that works successfully:

"=([Actual Cost]@row - [Estimate Cost]@row) / [Estimate Cost]@row)"


I was wondering how I can implement this formula within an IF formula? For example, I would like this formula to be ran if Project Category is "A", otherwise return "N/A". So the formula I wrote was:

"=IF([Project Category]@row = "A", ([Actual Cost]@row - [Estimate Cost]@row) / [Estimate Cost]@row), "N/A"))"


The IF formula works fine without the formula ("=IF([Project Category]@row = "A", "True", "N/A"))", but when I combine it, it's #UNPARSEABLE

Any help is appreciated, thank you in advance.

Best Answer

  • Genevieve P.
    Genevieve P. Employee Admin
    Answer ✓
    Options

    Hi @Sean Huynh,

    I can see that you marked David's response as not answering your question, so here's an example of what he explained typed out:

    =IF([Project Category]@row = "A", (([Actual Cost]@row - [Estimate Cost]@row) / [Estimate Cost]@row), "N/A")


    You'll notice that I added an extra ( before [Actual Cost]@row, as @David Joyeuse outlined, and took away the extra one at the end. Try copy/pasting this into your sheet! If this doesn't resolve the issue you're seeing, a screen capture of your sheet would help (but please block out any sensitive data).

    Cheers,

    Genevieve

Answers

  • David Joyeuse
    David Joyeuse ✭✭✭✭✭
    Options

    Hi @Sean Huynh

    =IF([Project Category]@row = "A", ([Actual Cost]@row - [Estimate Cost]@row) / [Estimate Cost]@row), "N/A"))

    Either add a ( before [Actual Cost]@row, or remove the one after [Estimate Cost]@row. Also there's one too many at the end of the formula.

  • Genevieve P.
    Genevieve P. Employee Admin
    Answer ✓
    Options

    Hi @Sean Huynh,

    I can see that you marked David's response as not answering your question, so here's an example of what he explained typed out:

    =IF([Project Category]@row = "A", (([Actual Cost]@row - [Estimate Cost]@row) / [Estimate Cost]@row), "N/A")


    You'll notice that I added an extra ( before [Actual Cost]@row, as @David Joyeuse outlined, and took away the extra one at the end. Try copy/pasting this into your sheet! If this doesn't resolve the issue you're seeing, a screen capture of your sheet would help (but please block out any sensitive data).

    Cheers,

    Genevieve

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!