Insert Carriage Return in Custom Format: Possible? How?

UniMord

Active Member
Joined
May 6, 2002
Messages
311
Is there any way to sneak a Carriage Return into a Custom Format?

For example, I'd like the format to show: $#,##0(CR HERE)"(I & B)"
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
UniMord - did you see my subsequent post? You can do what you originally wanted to do -- just use a smidgeon of VBA and it's easy enough.
 
Upvote 0
That code leaves the entries as strings. I will still need to parse out the numbers and sum them up. No?

Also, how do I apply this function to the column in question?
 
Upvote 0
No, the code I posted is altering the NumberFormat property of the cells exactly as you first were thinking. So the items in the cells are actually just numbers. [Run the last one there on a cell with just a number in it and look at your formula bar.] In addition to the reasons you first cited (ease of summing), using number formatting is also better because you could then apply your parenthetical descriptions on cells containing formulas.
 
Upvote 0
UniMord said:
...how do I apply this function to the column in question?
Just drop that code into a standard module. Skip back to Excel and select the cell you want to modify. Run the macro and input the description you want when prompted. If you select more than one cell, all the cells will have the same description applied.
 
Upvote 0
It works beautifully, with one small flaw, in that it forces the use a very wide column, upon threat of ###################ing the cell.

Why is that, and can it be fixed?
 
Upvote 0
I'm not sure why, but even with wrap text turned on, Excel seems to be estimating the needed column width as the width of the number and the subsequent description. If the column is not wide enough for it to fit as though wrap text were false, it's showing ###### even though it ought not to. (Guess the developers didn't anticipate us sneaking CR's into number formats.)
 
Upvote 0
Another go ( I didn't know about the blank cells ):
Code:
=SUM(VALUE("0"&LEFT(A1:A6,SEARCH(CHAR(10),A1:A6&CHAR(10))-1)))
 
Upvote 0
That is a very clever way of forcing the formula to work! I'll have to add that to my bag of tricks.

Unfortunately, it doesn't work in my particular case since all the cells with entries start with a $ sign, and adding the "0" won't work.
 
Upvote 0
Nicely done, Glenn. I had played with trying to add a zero or multiply by one or coerce with a "--" to handle the "" from blank cells. I can't believe I didn't think to concatenate a "0" on the left. :rolleyes: Again, kudos. (y)
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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