+ Reply to Thread
Results 1 to 5 of 5

Can we use OR formula with IF in the merge field....

  1. #1
    Registered User
    Join Date
    06-07-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    66

    Question Can we use OR formula with IF in the merge field....

    Hi,

    This is related to Mail Merging a document with specified conditions.

    I tried to explore the forum but couldnt find my answer.... Hope someone can provide a solution to my query.

    I have a Word document which have certain merge fields like "Name" "Address" "City" "State" etc. learned how to use the IF formula in the merge field for eg.

    {IF {MERGEFIELD State} = "A" "Paragraph 1." "{IF {MERGEFIELD State} = "B" "Paragraph 2." " "} "}

    however what I am searching for is that can the function "OR" be added in the "IF" function like we do it in EXCEL for eg:

    IF(OR(MERGEFIELD State = "A" OR MERGEFIELD State = "C" OR MERGEFIELD State = "E") than "Paragraph 1" and then again followed by IF....


    Your quick response will be highly apprecaited.... Thank you.

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Can we use OR formula with IF in the merge field....

    Hi!

    Try the following layout for your formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Hope this helps

    EDIT: Sorry, ignore this I didn't read your OP correctly the first time. I actually can't help you because I have not dealt with mail merges before. I just can't work out how to delete my post. Sorry!
    Last edited by ajryan88; 08-17-2013 at 06:29 PM.

  3. #3
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Can we use OR formula with IF in the merge field....

    You can use field coding like:
    {IF{IF{MERGEFIELD State}= "A" 1 0}+{IF{MERGEFIELD State}= "C" 1 0}+{IF{MERGEFIELD State}= "E" 1 0}= 1 "Paragraph 1" "Paragraph 2"}

    Note: The field brace pairs (ie '{ }') for the above example are created in the body of the document via Ctrl-F9 (Cmd-F9 on a Mac) - you can't simply type them or copy & paste them from this message.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    Registered User
    Join Date
    06-07-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    66

    Re: Can we use OR formula with IF in the merge field....

    Thank you very very much for responding to my query...
    however i am just trying to understand it a little more... what are the '1 0' (highlighted below) that you have entered at the end of every brace? Thanks again for your time.

    {IF{IF{MERGEFIELD State}= "A" 1 0}+{IF{MERGEFIELD State}= "C" 1 0}+{IF{MERGEFIELD State}= "E" 1 0}= 1 "Paragraph 1" "Paragraph 2"}

  5. #5
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Can we use OR formula with IF in the merge field....

    Basically, what you have is a series of IF tests of the 'State' mergefield. With {IF{MERGEFIELD State}= "A" 1 0}, for example, the IF test outputs 1 if the State is A and 0 otherwise. The results of these three IF tests are added together (e.g. 1+0+0 = 1 or 0+1+0 = 1 or 0+0+0 = 0) and compared against '1' in another IF test to determine the ultimate output.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using Merge Field in file name?
    By The Boosh! in forum Word Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2011, 08:28 AM
  2. joing (merge) tables by key field
    By Alex Kachanov in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  3. joing (merge) tables by key field
    By Alex Kachanov in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  4. joing (merge) tables by key field
    By Alex Kachanov in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  5. [SOLVED] Merge an alpha field and a numeric field
    By grams in forum Excel General
    Replies: 3
    Last Post: 08-29-2005, 07:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1