How to keep accounting formatting for cell with formula

kmsprague

New Member
Joined
Nov 14, 2022
Messages
27
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a formula in a cell that is working perfectly, but I can't keep the accounting formatting in the cell. I've tried the regular format cells option as well as conditional formatting, but I can't keep the left justified $ like I want. Any suggestions?

Formula:
1694212168411.png


Result:
1694212188949.png


Desired Result:
1694212216856.png
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I imagine it is losing the formatting because you are forcing it to be text. Perhaps you can try this:

Excel Formula:
=LET(maxlength, 15,text, TEXT(IF($F$17="Employee Only","1250","2500")," $ #,##0.00__ ; $ (#,##0.00)_ ; $ ""-    """),length, LEN(text),diff, MAX(0,maxlength-length),newtext, SUBSTITUTE(text,"$ ","$"&REPT(" ",diff)),newtext)

Formula found here: 6 Ways to Add Accounting Number Format in Microsoft Excel | How To Excel
I changed the D3 reference in the original formula to your IF formula.
 
Upvote 0
I imagine it is losing the formatting because you are forcing it to be text. Perhaps you can try this:

Excel Formula:
=LET(maxlength, 15,text, TEXT(IF($F$17="Employee Only","1250","2500")," $ #,##0.00__ ; $ (#,##0.00)_ ; $ ""-    """),length, LEN(text),diff, MAX(0,maxlength-length),newtext, SUBSTITUTE(text,"$ ","$"&REPT(" ",diff)),newtext)

Formula found here: 6 Ways to Add Accounting Number Format in Microsoft Excel | How To Excel
I changed the D3 reference in the original formula to your IF formula.
Hi dreid! This is SO close to what I need! But it's still not justifying the $ all the way to the left. I know it's such a small thing, but it looks out of place next to the numbers in other cells.
1694213329933.png
 
Upvote 0
I imagine it is losing the formatting because you are forcing it to be text. Perhaps you can try this:

Excel Formula:
=LET(maxlength, 15,text, TEXT(IF($F$17="Employee Only","1250","2500")," $ #,##0.00__ ; $ (#,##0.00)_ ; $ ""-    """),length, LEN(text),diff, MAX(0,maxlength-length),newtext, SUBSTITUTE(text,"$ ","$"&REPT(" ",diff)),newtext)

Formula found here: 6 Ways to Add Accounting Number Format in Microsoft Excel | How To Excel
I changed the D3 reference in the original formula to your IF formula.
Ok, I added some spaces in the formula between the $ and the # and now it looks good!! Thank you so much, dreid!
1694213756043.png
 
Upvote 0
I don't understand why you are putting the numbers in as text. What happens if instead
Instead of "1,250.00","2,500.00" you just put 1250,2500 and then copy the formatting from a cell that looks the way you want it
 
Upvote 0
Solution

Forum statistics

Threads
1,215,092
Messages
6,123,063
Members
449,090
Latest member
fragment

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top