if-then-else Question

F

fisher27

Hi, Everyone!

I'm trying to do a conditional paragraph Merge that is stumping me.
have a column of data in an Excel Spreadsheet that contains number
seperated by commas, for example 1,21,32,34... I would like to do
conditional paragraph based on that column of data, for example: if
particualar person has a "21" in that field, then place the followin
words in the letter "...I see that you...". I know that I need to d
an if-then-else and I've tried to use a wildcard with the if-then-els
feature, but only with limited success. Is there another way for wor
to search through a string of numbers or letter and isolate
particular one(s)? Thanks to anyone who can help!

ps I just found this forum a couple of days ago and it is great!
will be a frequent visitor here!

Mik
 
M

macropod

Hi Mike,

If you're merging a comma-separated string, word can't separate any portions
out unless all segments are 3 digits long. That's because the comma
represents a thousands separator and your data would have to conform to
that. In fact, even without the commas, if your string was simply a seies of
2-digit numbers, a bit of field maths could check whether a particular vale
appears in a given position. If the position varies, things rapidly get more
complicated.

Cheers
 
C

Cindy M -WordMVP-

Hi Fisher27,

This is (unfortunately) not something Word does well at all. Functions
for string manipulation in Word fields are virtually non-existant, the
closest is the Compare function, and its usefulness is limited.

Since your data is in Excel, my suggestion would be to set up these
criteria and filters in additional columns (fields) in Excel. You can
either do the entire IF thing in Excel, or test the "simplified" field
in the main merge document.
I'm trying to do a conditional paragraph Merge that is stumping me. I
have a column of data in an Excel Spreadsheet that contains numbers
seperated by commas, for example 1,21,32,34... I would like to do a
conditional paragraph based on that column of data, for example: if a
particualar person has a "21" in that field, then place the following
words in the letter "...I see that you...". I know that I need to do
an if-then-else and I've tried to use a wildcard with the if-then-else
feature, but only with limited success. Is there another way for word
to search through a string of numbers or letter and isolate a
particular one(s)?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
M

macropod

Hi Cindy,

Not applicable to the original post, but you might be surprised what can be
done. Try the following:
{QUOTE"The string "{SET ID "1233-45-6789""}{ID}" is made up of "{SET
EXP1{={=-{ID}-ID}/2}}{EXP1}", "{SET EXP2{=({ID}*(-1)-{ID})*(-1)/2}}{EXP2}
, "{SET EXP3{={=-{=-{ID}-ID}/2}-(({ID}*(-1)-{ID})*(-1)/2+{ID})}}{EXP3}}
Just a demo of how to separate out parts of formatted three-segment numbers,
including US Social Security Numbers. By deleting the extraneous text and
string manipulations for EXP1 and EXP2, this might be useful for anyone
doing mailmerges etc where only the last 4 digits can be dispalyed.

Cheers
 
C

Cindy M -WordMVP-

Hi Macropod,

Makes my head ache <g> Just goes to show how "unpredictably" Word really deals
with strings that contain numbers and mathematical characters <shudder> I'd
almost bet you stumbled on this while trying to sort zip codes...

I have some quibbles with how you address the ID bookmark in a couple of
places (missing field brackets and see below), and I prefer this calculation
syntax for EXP1
{ = -(-({ ID })-{ ID })/2 }
but point taken :) It's especially shocking to realize that, for Word,
-({ID}) and -{ID} and {ID}*(-1) are NOT the same thing! The first two I can
follow, but the last defies all mathematical logic <sigh> (I can see what's
happening, but WHY it should happen ought to be forbidden!)

About the { ID } construct: Under special circumstances, Word will not
actually use the value you expect in an implicit REF field. A few years ago,
someone was asking why-oh-why they were getting the wrong results for their
"bookmark" DM. Turns out they were in a German locale, and DM was the currency
"symbol" set in Windows. Word was using the currency information instead of
what was being passed into the document by the *mergefield* DM. IOW, withouth
the field name, Word will sometimes give something else precedence. So I've
made it a habit to always include REF (or MERGEFIELD), even if it makes it
more difficult to keep an overview.
Not applicable to the original post, but you might be surprised what can be
done. Try the following:
{QUOTE"The string "{SET ID "1233-45-6789""}{ID}" is made up of "{SET
EXP1{={=-{ID}-ID}/2}}{EXP1}", "{SET EXP2{=({ID}*(-1)-{ID})*(-1)/2}}{EXP2}
, "{SET EXP3{={=-{=-{ID}-ID}/2}-(({ID}*(-1)-{ID})*(-1)/2+{ID})}}{EXP3}}
Just a demo of how to separate out parts of formatted three-segment numbers,
including US Social Security Numbers. By deleting the extraneous text and
string manipulations for EXP1 and EXP2, this might be useful for anyone
doing mailmerges etc where only the last 4 digits can be dispalyed.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top