In-cell (not VBA) formula to define number format

ShogunPatch

Board Regular
Joined
May 8, 2009
Messages
52
Are there any built-in functions which allow me to define a custom number format as a parameter? Failing that, is there any way of creating a user defined function that contains a "format_number" parameter in the same way that the TEXT function has a "format_text" parameter?

I have a large spreadsheet calculating many thousands of values. The values in each row need to be displayed in any one of half a dozen or more custom number formats, determined according to a code in column AB. Ideally, the format itself would be defined in a table on another sheet which could be easily amended or added to.

I have tried using conditional formatting, which sort of works, but the problem is that the number format does not always update when I change the code in any given row. This appear to be a known problem, which I have researched on various forums, but none of the mooted solutions have solved it in my case. Perhaps more importantly, if I need to alter or add a custom format, updating all the conditional format rules is a major enterprise.

I have successfully been able to convert the number into a text value which displays in the format I want using the built-in TEXT function. I can then convert the text value back into a number using the built-in VALUE function. The problem is that apart from this seeming to me to be quite a convoluted approach, it also has the unacceptable side-effect of rounding the value, which I don't want.

Any suggestions would be much appreciated.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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