Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi.
Does anyone know how to suppress a space appearing before a field if the field appearing before it is empty?
My situation is this: I have a large Excel spreadsheet with names and addresses, etc. Unfortunately, the person who compiled much of the data source had a habit of putting the whole name ("John Smith") into the surname column, and nothing at all in the first-name column. To make matters worse, she didn't follow this practice consistently, so that some entries do have both cells filled. Consequently, when I do a mailmerge with "<<First_Name>> <<Last_Name>>", in the cases where the whole name was in the second of the two fields, I get a blank field, followed by a SPACE, followed by the name - in effect, a space and then the name. So what I want to know is, can I give Word (2003) an instruction to suppress a space following a field if that field is empty?
Thanks.

Crikey ! ok how does this sound, if you delete the spaces between the <<field names>> can you put them in using the insert word field > if....then....else !!
Something along the lines of if field name is not blank then insert " "
So if the field is occupied it will insert a space (and will be correctly formatted) if the first field is blank then an extra space is not inserted
Techy n Welsh

Thanks for that - it's potentially very helpful. Now, does anyone know the extact syntax I should type into the box after the "IF" command, in order to achieve this.... ?

I would just fix the problem all together. Firt make a backup copy of your original spreadsheet. Then make a temp copy of the spreadsheet.
Sort your temp spreadsheet and your original so that the names that appear in one field are grouped together.
Delete all the records where the full name is in one field from your original. Then delete all other records from the temp.
Save the temp file as space delimited. Then import the name into the apporpriate fields in the original using the space delimiter.

The answer is given here:
http://totaltutorials.com/Tutorials/Go.asp?ID=2250
Scroll down for the second item: 'Suppressing unwanted spaces and commas within a line of an address', all for mailmerge use.

![]() |
autoreply in Outlook
|
Office XP and Office 97
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |