Custom number format via formula

  • Thread starter Thread starter cube.head
  • Start date Start date
C

cube.head

I'm using that arcane trick where you set the format of a cell to a text
value - for instance if the cell is a 2, I set use "Format Cells..." and set
the cell format to "Custom" and the format code to "Initial Planning
complete". I do this to be able to display the value "Initial Planning
complete" as a data label.

This works well, but it's a manual task. I'm looking for a way to apply the
custom format code for each cell, using a formula somehow. The format code
would come from another cell, ideally.

I'd like to avoid using VBA to do this, although that'd be easiest... Is
there any way to do this using formulas? Thanks for any ideas.
 
I'm using that arcane trick where you set the format of a cell to a text
value - for instance if the cell is a 2, I set use "Format Cells..." and set
the cell format to "Custom" and the format code to "Initial Planning
complete". I do this to be able to display the value "Initial Planning
complete" as a data label.

This works well, but it's a manual task. I'm looking for a way to apply the
custom format code for each cell, using a formula somehow. The format code
would come from another cell, ideally.

I'd like to avoid using VBA to do this, although that'd be easiest... Is
there any way to do this using formulas? Thanks for any ideas.

You cannot change the format of a cell using a function.

However, with the result in one cell, you can display in another cell that
result with your custom function by using the TEXT worksheet function.

e.g. = text(a1,"#,##0.00")

and the format string can be located in some cell.
--ron
 
Thanks Shane. I don't think that I can use XLChartLabeler, as this chart is
destined to become available via Excel Services. I'm not sure what the story
is with Excel Services and VBA code, but I think I've heard that it's not
good :-(

I tried the TEXT function, but all I get is a scrambled-looking version of
my string:
=TEXT(A1,"This is a test") gives "T0i0 i0 a t19000t"
 
Back
Top