Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-02-2015, 06:58 PM
macropod's Avatar
macropod macropod is offline Could anyone fix the attached if statement. thx Windows 7 64bit Could anyone fix the attached if statement. thx Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could use either:
{QUOTE"{SET Months {MERGEFIELD Loanmonths}}{=INT(Months/12) \# "0' year(s)'"} and {=MOD(Months,12) \# "0' month(s)'"}"}
for an output like:
# year(s) and # month(s)
or, somewhat more sophisticated:
{QUOTE"{SET Months {MERGEFIELD Loanmonths}}{=INT(Months/12)-1 \# "{=INT(Months/12) \# "0' years'"};;'1 year'"}{=(Months-INT(Months/12)*12)*(Months>12) \# "' and ';;"}{=MOD(Months,12)-1 \# "{=MOD(Months,12) \# "0' months'"};;'1 month'"}"}"}
for an output like:
1 month
2 months
1 year
2 years
1 year and 1 month
1 year and 2 months
2 years and 1 month
2 years and 2 months

For a macro to convert the above field code text representations to working field codes, See Convert Text Representations of Fields to Working Fields in the Mailmerge Tips and Tricks sticky thread (https://www.msofficeforums.com/mail-...ps-tricks.html) at the top of this forum.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
One email with 2 photos attached won't load dijear Outlook 0 03-08-2015 07:48 PM
Could anyone fix the attached if statement. thx Please Help for VBA Code for Attached File.. krishnaoptif Word VBA 3 07-17-2012 12:29 AM
Removing Attached Mailboxes Hack Outlook 0 10-14-2011 06:09 AM
Open an attached email and sent does not work M_O_C Outlook 0 07-27-2011 09:36 AM
Could anyone fix the attached if statement. thx value attached to a name grilem2 Excel 3 04-15-2011 06:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft