Remove trailing zeros

pcrowley

Board Regular
Joined
Dec 12, 2011
Messages
118
I am creating a sheet where numbers are raised to negative powers of ten. If I format the cells with the Number Type set to Number and the Decimal Places set to 0 all numbers less than 1 display as 0. I can format each cell individually to display the number of decimal places I want which eliminates zeros to the right of the last non-zero number. Is there a way to format the cell to automatically remove zeros to the right of the last nonzero number?

For example 10 raised to the negative 5 should display as 0.0005, but if I need to raise the same number to the negative 8 I would need to change the number of decimal places displayed.

Thank you or any help!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Um, first off 10^-5 isn't .0005, it's .00001

Why can't you just leave the formatting as General?
 
Upvote 0
Thank you Scott, of course 10^-5 is .0001 was multi-tasking ad not thinking. I didn't want to use General format because sometimes I am using positive powers of 10 and I wanted commas included, and I don't think the General format allows commas. I wasn't clear about that in my post.

Thank you Mike your solution worked perfectly. I now know more than I did before about using a custom format.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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