Custom number formatting which limits decimals, but prevents Rounding to zero

StrawberryDreams

Board Regular
Joined
Mar 26, 2022
Messages
52
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
How do you go about creating custom and or conditional number formatting which will limit the amount of decimals to be displayed, but allow the full entered amount as is, if the decimals either round to Zero, or won't fit into the cell and give ###### -( and in those cases possibly auto reduce font size to fit ) then return font size to cell when cleared.. Here is a chart with some conditions . If this has been answered and someone has a link that would be great too.

Basic data calculator test 4.xlsm
EFGHI
5Values as enteredValue displayedValue I want displayed
644.00%4%if no decimal display as single integer
755.00%5%if no decimal display as single integer
812.112.10%12.1 %If one decimal point just display one / don't add a zero
90.000090.00%0.00009 %Don’t' round to zero and rather just display fully . If there are too many decimals to fit into cell and prevent ##### from appearing then auto reduce font size to fit, but don’t increase row height. But return font size back when cell is cleared.
105.095.09%5.09%Show two decimals if last one is not a zero
110.10.10%0.1 %Don't show zero
120.010.01%0.01%Show two decimals if last one is not a zero
130.0030.00%0.003%Don't round decimal points to zero
14
Sheet6
Cell Formulas
RangeFormula
H8H8=12.1 &" %"
H9H9=0.00009 &" %"
H11H11=0.1 & " %"
H12H12=G12
H13H13=0.003 & "%"
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Would you just write a bunch of different conditions in the conditional formatting formula pane ? Such as counting the number of decimals then selecting the appropriate number format and font size ?

maybe something like this:
=LEN(RIGHT(F6,LEN(F6)-FIND(".",F6)))
 
Upvote 0
maybe something like this:
=IFERROR(LEN(RIGHT(F6,LEN(F6)-FIND(".",F6))),0)

if no decimal then it will give a 0, otherwise it will count the number of decimals.
Then I plug this formula into a helper column , and do conditional formatting based on the helper column result but apply it to the F column...
 
Upvote 0

Forum statistics

Threads
1,215,422
Messages
6,124,811
Members
449,191
Latest member
rscraig11

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