![]() |
|
|
|
#1
|
|||
|
|||
|
I would appreciate any help. I have a merged field as a whole number for example, 60, 90, 45, 30. I would like to convert that to hours and minutes, so the output would look something like this. 1 hr 1 hr 30 min 45 min 30 min Notice that if its 0 hours or 0 min then I don't need to output anything. Many thanks in advance |
|
#2
|
||||
|
||||
|
You could use a field construction like:
{=INT({MERGEFIELD Minutes}/60) \# "0' hr '"}{=MOD({MERGEFIELD Minutes},60) \# "0' min'"} or {=INT(«Minutes»/60) \# "0' hr '"}{=MOD(«Minutes»,60) \# "0' min'"} where 'Minutes' is your datafield name. NOTE: The field brace pairs (i.e. '{ }') for the above field code examples are 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. Likewise, the chevrons (i.e. '« »') - are part of the actual mergefields, inserted via the 'Insert Merge Field' dropdown (i.e. you can't type them or copy & paste them from here). The spaces shown in the field constructions are all required.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Quote:
I have tried this but the output I get is something like that 0 hr 30 min I am trying to remove the 0 hr or 0 min if there is any, so the end result will be just 30 min or 2 hr or 1 hr 15 min Thanks, |
|
#4
|
|||
|
|||
|
I believe I solved my own question!
{IF {=INT(«Minutes»/60)} > 0 {=INT(«Minutes»/60) \# "0' hr '"}} {IF {=MOD(«Minutes»,60)} > 0 {=MOD(«Minutes»,60) \# "0' min'"}} Might not be best way, but it seems to work |
|
#5
|
||||
|
||||
|
Change the:
{=INT({MERGEFIELD Minutes}/60) \# "0' hr '"} or {=INT(«Minutes»/60) \# "0' hr '"} to: {=INT({MERGEFIELD Minutes}/60) \# "0' hr ';;"} or {=INT(«Minutes»/60) \# "0' hr ';;"} Likewise, change the: {=MOD({MERGEFIELD Minutes},60) \# "0' min'"} or {=MOD(«Minutes»,60) \# "0' min'"} to: {=MOD({MERGEFIELD Minutes},60) \# "0' min';;"} or {=MOD(«Minutes»,60) \# "0' min';;"}
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#6
|
|||
|
|||
|
That worked perfect, thank you so much!
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Countdown of Days, Hours, Minutes and Seconds | Chris Waller | PowerPoint | 3 | 01-31-2022 03:22 AM |
| Calculating Total Hours & Minutes Worked | aaghd72 | Excel | 2 | 04-13-2019 03:32 AM |
| Outlook 2013 gives 12 decimals after the minutes/hours | Curious | Outlook | 0 | 11-23-2017 08:38 AM |
Trouble with absolute values and hours/minutes and formulas
|
dglazer | Excel | 2 | 07-28-2015 01:42 AM |
| How to transform hours into minutes in mail merge | ppochelon | Mail Merge | 1 | 09-29-2013 07:07 PM |