# Thread: error with If formula in Word

1. ## error with If formula in Word

Hello,

I need to use If Formula in Word but unfortunately it is not working.

I have used the follwing syntax

{=IF{B1}="" "Yes" "No"}

which means if b1 is blank return Yes otherwise NO. Could you please let me know what is wrong with my syntax

and my second part is that I want to count number of occurrences of Blank B cells. How can I do it?

thanks

2. Word fields cannot test text with cell references; only numbers can be tested. To test text, the text would have to be bookmarked; then you can test the bookmark's content. Accordingly, the solution depends on what the content of B1 might be when it is not blank. If B1 can be blank or contain non-zero numbers, you could use:
{IF{=B1}= 0 "Yes" "No"}
(note the corrected syntax) or even:
{=B1 \# "'No';'No';'Yes'"}

As for counting blanks (again assuming your cells only contain blanks of non-zero numbers), you could use a formula like:
{=10-COUNT(B2:B11) \# 0}

Note: The above formula work even if the cells have text in them, provided the only numbers are non-zero (e.g. 1, 10, etc. but not 0 on its own).

To see how to do a wide range of calculations in Word, check out my Microsoft Word Field Maths Tutorial. It's a 'Sticky' thread at the top of this forum:
https://windowssecrets.com/forums/sho...Maths-Tutorial

I want to count number of occurrences in "Text" word in B column. how can I do it?

thanks

4. You would need to bookmark each range in column B, not including the end-of-cell markers, and use a formula field like:
{={IF{Text1}= "Text" 1 0}+{IF{Text2}= "Text" 1 0}+{IF{Text3}= "Text" 1 0}+{IF{Text4}= "Text" 1 0}+{IF{Text5}= "Text" 1 0}+{IF{Text6}= "Text" 1 0}+{IF{Text7}= "Text" 1 0}+{IF{Text8}= "Text" 1 0}+{IF{Text9}= "Text" 1 0} \# 0 }
where Text1, Text2, etc. are your bookmark names.

#### Posting Permissions

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