Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Oct 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    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:
    http://windowssecrets.com/forums/sho...Maths-Tutorial
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    New Lounger
    Join Date
    Oct 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for reply

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

    thanks

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    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.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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