Show Decimal Points if needed [Quick Tip]

Share

Facebook
Twitter
LinkedIn

Sometimes you want to turnoff decimal points if the value after point is 0. Mireya, Chandoo.org member had one such situation. She writes:

I am a complete beginner in excel, how can I keep the zeros when I am working with decimals and remove them when are not required, ie

Thanks for your kind help.

Easy way: Use General Formatting

The default cell formatting in Excel is General. When you set a cell’s formatting to General, you are telling Excel,

Don’t bother me. Just figure it out.

General Formatting in Excel - Use it to simplify your cell formatting needs

And being a good Samaritan, Excel shows decimal point if there is something after it, else omits it.

See the demo aside to understand this.

General formatting in Excel - demo

What if your numbers are results of a calculation?

It doesn’t matter. General formatting takes good care of the cells. It shows and hides decimal point depending on the result of your formulas.

What if you want something fancy like accounting format, but turn off decimal values

Now you are talking. The General Formatting option shows numbers as typed (or calculated). So 124578395 would look like 124578395 instead of $ 12,45,78,395.

So how do you show $1,245 and $1,246.34?

Aside: You should always show decimal points if some values have them and others don’t. The below technique is useful when data is a result of calculation. For example: In a dynamic KPI report, for certain KPIs you may want to show decimal points, and omit for others.

Show decimal values only if needed - Excel cell formatting using conditional formatting

To show decimal point if there is something after it

Conditional formatting rule to show decimal point if needed
Just follow below steps:

  1. Select the cell(s) where you want this formatting.
  2. Go to Conditional Formatting > New rule from home ribbon.
  3. Select rule type as “Use a formula…”
  4. Check if there is a value after decimal point using a formula like =Mod(A1,1)>0
  5. Click the format button
  6. Go to “Number” tab and Apply formatting with 2 decimal places.
  7. Click OK & You are done!

Now, if the cell has a decimal value, it shows, otherwise the decimal point is omitted.

Related: Conditional formatting Basics

Do you deal with such situations when formatting numbers?

Often when making reports (or dashboards), I have a cell where any data can go, based on user selection. In such cases, I use conditional formatting to define how it looks based on the data. Sometimes, I also use TEXT formula to format the data. This is more suitable when data is displayed in a text box rather than a cell.

What about you? Do you face situations like this? How often you rely on General formatting? Please share your experience and tips using comments.

More on Number formatting in Excel

Understanding how Excel formats numbers (and other values) can save you lots of time when you are designing dashboards, reports or workbooks that need to presented. Check out below articles to get few more tips.

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

4 Responses to “Best of Chandoo.org – 2013”

  1. Kushal K Shah says:

    sir i want your autograph

  2. Maxim Manuel says:

    How many times during the year did I click on most of the pages there to learn something new? Thank you Chandoo!

  3. Cad says:

    =TEXTSPLIT(jobs[Job title],{" - "," ("," /"})

  4. Cad says:

    =TEXTSPLIT(jobs[Job title],{" - "," ("," /"})

    =CHOOSECOLS(TEXTSPLIT([@[Job title]],{" - "," ("," /"}),1) -- for tables

Leave a Reply