Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-18-2022, 10:40 AM
rprice124 rprice124 is offline Dollar amount in words Windows 10 Dollar amount in words Office 2019
Novice
Dollar amount in words
 
Join Date: Nov 2022
Posts: 3
rprice124 is on a distinguished road
Default Dollar amount in words

I'm in need of some expert help, i'm trying to switch a dollar amount into words, with dollars and cents. Below is what i have and it's returning to blank, not sure what i'm missing on this, but any suggestions would be greatly appreciated!





(Quote{Set Val {MERGEFIELD PCORevTotalCons}"=INT(Val)\* CardText} dollar{ =Int(Val)-1 \# "s;s;"}{ IF{=MOD(Val,1) \#0.00}>0 " and { ={ =MOD(Val,1)*100 \ # 0 } \* CardText } cent{ = INT(MOD(Val,1)*100-1) \# "s;s;" }" " and zero cents"}" \* First Cap}
Reply With Quote
  #2  
Old 11-18-2022, 04:05 PM
macropod's Avatar
macropod macropod is offline Dollar amount in words Windows 10 Dollar amount in words Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,861
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

Your field coding has various errors. Try:

{QUOTE{SET Val «PCORevTotalCons»}{=INT(Val) \* CardText}" dollar{=INT(Val)-1 \# "s;s;"}"
{IF{=MOD(Val,1) \# 0.00}> 0 " and {=MOD(Val,1)*100 \# 0 \* CardText} cent{=INT(MOD(Val,1)*100-1) \# "s;s;"}"} \* FirstCap}

You'll find essentially the same field coding in the Mailmerge Tips & Tricks 'Sticky' thread at the top of this page (https://www.msofficeforums.com/mail-...ps-tricks.html), under the heading Mailmerge Number & Currency Formatting

Note: The field brace pairs (i.e. '{ }') for the field code example above are all created in the mailmerge main document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from here. Nor is it practicable (for the most part) to add them via the standard Word dialogues. The spaces shown in the field constructions are all required. The line break, though, isn't needed - it just there for layout purposes
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-21-2022, 06:19 AM
rprice124 rprice124 is offline Dollar amount in words Windows 10 Dollar amount in words Office 2019
Novice
Dollar amount in words
 
Join Date: Nov 2022
Posts: 3
rprice124 is on a distinguished road
Default

Thanks for your response macropod, I'm still not getting anything to return when i tried your code, I'm sure I'm missing something in the entry of the code.

I did the Alt F9 then copied and pasted your solution inside the {} of my current code, is there a better way to accomplish this?
Reply With Quote
  #4  
Old 11-21-2022, 06:26 AM
macropod's Avatar
macropod macropod is offline Dollar amount in words Windows 10 Dollar amount in words Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,861
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 the macro found under Convert Text Representations of Fields to Working Fields in the Mailmerge Tips & Tricks 'Sticky' thread to convert the field representation I posted into a working field.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 11-21-2022, 08:08 AM
rprice124 rprice124 is offline Dollar amount in words Windows 10 Dollar amount in words Office 2019
Novice
Dollar amount in words
 
Join Date: Nov 2022
Posts: 3
rprice124 is on a distinguished road
Default

Great! That did the trick greatly appreciate your help!

One last question, if the value is negative, I'm getting an error, is there a way to update the code to switch a negative to a positive?
Reply With Quote
  #6  
Old 11-21-2022, 03:20 PM
macropod's Avatar
macropod macropod is offline Dollar amount in words Windows 10 Dollar amount in words Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,861
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

Simply change:
{SET Val «PCORevTotalCons»}
to:
{SET Val {=ABS(«PCORevTotalCons»)}}
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
mail merge, mail merge code, mail merge help

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dollar amount in words Rounding of dollar value Formd Mail Merge 2 07-06-2022 01:21 PM
Dollar amount in words Sum Each Dollar Amount by Phase Karen615 Excel 8 04-09-2020 03:55 PM
Dollar amount in words Construction of a value to amount in words in mail merge Marcia Mail Merge 2 08-08-2019 06:08 AM
help creating a dollar counter add-in dstallworth PowerPoint 0 04-23-2017 12:49 PM
Convert Dollar amount to text GeorgeLawshe Word 0 03-07-2010 10:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:27 PM.


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