2

I am trying to created a formula in my spreadsheet in which if a certain cell has the text value of "enrolled" then the spreadsheet reflects the difference of two cells. I entered this formula but it is incorrect.

=IF(B2="enrolled", R2-N2)

How do I fix this? I also want to add into the formula if the text value is "waived" or "terminated" then the value will be "N/A"

2 Answers 2

3

To put in the waived and terminated section use nested if statements

=IF(B2="enrolled", R2-N2,IF(OR(B2="waived",B2="terminated"),NA(),""))
2

Try using the following formula:

=IF(B2="enrolled",R2-N2,"")

The IF statement needs a value for both FALSE and TRUE. So the second parameter in this case would be the subtract function that you wish. The formula will place nothing into the cell if B2="enrolled" comes out FALSE, which is controlled by the third parameter.

So the IF statement goes: =IF(LOGICAL_TEST,VALUE_IF_TRUE,VALUE_IF_FALSE)

5
  • 1
    The only thing the OP was missing was the last comma (,) after the R2-N2. But you did a great job explaining how the formula works. That is what the community needs.
    – CharlieRB
    Sep 4, 2015 at 16:59
  • I entered this formula but it is coming out N/A even though the value of S2 is "Enrolled" : =IF(S2="enrolled", R2-N2, ("N/A"))
    – Beckie
    Sep 4, 2015 at 17:17
  • This should work: =IF(S2="enrolled",R2-N2,"N/A")
    – Josh
    Sep 4, 2015 at 17:20
  • Both those work for me, check your spelling on what you entered in the cell. Make sure there are no leading or trailing spaces (can use trim function)
    – gtwebb
    Sep 4, 2015 at 17:21
  • That did it! There was a trailing space. Thanks so much Josh and gtwebb for your assistance! :)
    – Beckie
    Sep 4, 2015 at 17:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .