MrKowz
Well-known Member
- Joined
- Jun 30, 2008
- Messages
- 6,653
- Office Version
- 365
- 2016
- Platform
- Windows
Hey all,
I haven't used mail merge very much, and I have the need to keep the accounting format of a cell when it is merged into a word document. Basically, I need to make sure the dollar signs and decimals always line up.
My initial thought was to create a helper column that stores a value as a string, but I don't think that will work properly, since a space isn't the same width as other characters.
ex:
<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: right;;">775.34</td><td style="text-align: right;;">$ 775.34</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: right;;">9999999.99</td><td style="text-align: right;;">$ 9999999.99</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: right;;">1003.56</td><td style="text-align: right;;">$ 1003.56</td></tr></tbody></table><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style="background-color: #E0E0F0;text-align: center;color: #161120"><th><b>Sheet1</b></th></tr></td></thead></table><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">B7</th><td style="text-align:left">="$" & REPT(<font color="Blue">" ",15-LEN(<font color="Red">A7</font>)</font>) & TEXT(<font color="Blue">A7,"0.00"</font>)</td></tr></tbody></table></td></tr></table><br />
Any ideas would be much appreciated!
I haven't used mail merge very much, and I have the need to keep the accounting format of a cell when it is merged into a word document. Basically, I need to make sure the dollar signs and decimals always line up.
My initial thought was to create a helper column that stores a value as a string, but I don't think that will work properly, since a space isn't the same width as other characters.
ex:
<b>Excel 2007</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: right;;">775.34</td><td style="text-align: right;;">$ 775.34</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: right;;">9999999.99</td><td style="text-align: right;;">$ 9999999.99</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: right;;">1003.56</td><td style="text-align: right;;">$ 1003.56</td></tr></tbody></table><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style="background-color: #E0E0F0;text-align: center;color: #161120"><th><b>Sheet1</b></th></tr></td></thead></table><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">B7</th><td style="text-align:left">="$" & REPT(<font color="Blue">" ",15-LEN(<font color="Red">A7</font>)</font>) & TEXT(<font color="Blue">A7,"0.00"</font>)</td></tr></tbody></table></td></tr></table><br />
Any ideas would be much appreciated!
Last edited: