Share via

Word Fields, Avoiding Divide by Zero

Anonymous
2014-07-10T18:50:21+00:00

Hello, 

So I am having an issue with Word Fields.

I want to create a column, c, that divides the number in column a by the number in column b.

However, if b is equal to or less than 0, I want to get 0.

This seems like a simple if statement: { =IF(B1<=0,0,A1/B1) }

Regardless of the value of A, this works fine.  For my example, A will equal 5.

If B equals 1, it will evaluate correctly.  B is not less than or equal to 0, 5/1=5

If B equals -1, it will also evaluate correctly.  B is less than or equal to 0, 0

If B equals 0, it will NOT evaluate correctly.  B is less than or equal to 0, 0, but since the true would have evaluated to 5/0, the field gives up and returns nothing.

Is there a fix?

I could use A1/(B1+verySmallNumber), but I'd rather prefer not to if there is another way.

Thanks,

Christopher

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2014-07-11T00:47:38+00:00

Use

{ IF B1<=0 0 { = A1/B1 } }

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2014-07-11T12:20:53+00:00

    Thank you so much!

    It took me a bit to catch on that you can't just add curly braces into a field, but you actually need to add another field.

    Was this answer helpful?

    0 comments No comments