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

    Word 2010 IF formula to check string contents

    Hi all, I have a Word 2010 document that merges data from our back office database. I have a number of calculations in the document that are working fine but one of them has me really stumped.

    In one table cell (D1), the data merges in as a string, either Yes or No. I want to perform a calculation in another cell based upon the value of the string in the other cell. What I tried was:

    The intention is that if it's Yes then the cell has the value of 100 otherwise it's 0. But, the formula I tried gives a syntax error.
    Can anyone help with a solution? Many thanks in advance!

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator
    Join Date
    May 2002
    Canberra, Australian Capital Territory, Australia
    Thanked 194 Times in 177 Posts
    Word fields cannot reference strings in cells - only numbers. Since this is apparently a mailmerge, though, you should be able to ignore the cell reference entirely and text just the mergefield's content:
    {IF«MyField»= "Yes" 100 0}
    where MyField is your mergefield's name.

    Note: The field brace pairs (i.e. '{ }') for the above example are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar. The spaces represented in the field construction are all required.

    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