How to Remove Zeros in Front of a Number in Excel

While formatting data in excel, sometimes numbers can be recognized as some other format. As a result, there could be zeroes in front of a number that aren’t supposed to be there. In this article, we will learn how to remove zeros in front of a number in excel.

Key Takeaways

Use another cell in order to extract the data without zeros.
Write this formula in that cell:
=VALUE(B2)
Replace B2 with the source cell name

overview image

That was one method, but there are other methods as well. In this article, we will discuss all the methods you can use to remove zeros in front of numbers in excel. Therefore, keep reading this article so that you can use the methods you want to use for your dataset.

Download Practice Workbook
1

Using the VALUE Function

In this dataset, we have some budget information with spending data. However, the data was imported from some other application, which did not format the columns properly. As a result, we have data with leading zeros that aren’t supposed to be there. We must clean this data up to start working with it.

Take a helper cell to get the data without leading zeros.
Use this formula:

=VALUE(B2)

Autofill other cells using your mouse.

Using the VALUE Function

Explanation
The VALUE function converts text to a number. The source cell (B2) contains actual number data but is formatted as text, so we have to convert it to numbers. Cells formatted as numbers in excel have no zeros in front.

2

Formatting Cells Using the TEXT Formula

In this method, we will use a formula that uses the TEXT function to format the data in a way that removes the zeros and outputs other numbers as they are.

Take another column with the same rows so that we can autofill later.
Format using this formula:

=TEXT(B2, “0#”)

Autofill other cells to complete the job.

Formatting Cells Using the TEXT Formula

Explanation
The TEXT function takes the first parameter as an input and the second parameter as the format value. We are giving it the B2 cell as the input and asking it to format it using “0#”, where # represents a number.

3

Using a Combination of RIGHT-LEN-FIND-LEFT-SUBSTITUTE Functions

This formula will actually remove the zeros by substituting them with blanks instead of copying the cells and hoping that excel gets it right. Follow the steps below:

You know what to do by now, so get another cell to write the formula:

=RIGHT(B2, LEN(B2) – FIND(LEFT(SUBSTITUTE(B2, “0”, “”), 1), B2) + 1)

Using a Combination of RIGHT-LEN-FIND-LEFT-SUBSTITUTE Functions

Explanation
The RIGHT function copies values from the most right when it’s given how many characters to copy. Using the FIND function, we find the section where the nonzero characters start, while we SUBSTITUTE zeros with blanks. The LEFT function gives the leftmost character to FIND to find the position. Then we give the length of the rest of the cell by subtracting it from the original length, extracted using the LEN function. Lastly, one is added because so far we got the character position without zeroes, and we have to add one to get the character count to give it to the RIGHT function.

Now, if we autofill, we can see that all of the cells have their zeros removed.


4

Removing a Specific Number of Zeros Using IF-LEFT-RIGHT-LEN

The methods we have used so far remove all leading zeros in front of a number. But what if you want to remove just one or two zeros? In that case, you need to use the method described below:

In your helper cell, write this formula:

=IF(LEFT(B2) = “0”, RIGHT(B2, LEN(B2)-1), B2)

After filling the other cells up, we can notice that only the first zero was removed from every cell. For example, the B6 cell had two zeroes, and we got an output with a single zero only.

Removing a Specific Number of Zeros Using IF-LEFT-RIGHT-LEN

Explanation
The IF function is a helping hand here. The first parameter is the condition, the second one is the output while the condition is fulfilled, and the third one is when it is one. Here, the LEFT function checks whether there is a zero in front of the input cell. If the input cell (B2) has zeros in front, it will apply the whole formula, otherwise, it will just copy the cell. The RIGHT function copies the cell, except for the first zero. The length is defined by the LEN function, which subtracts 1 as we need to remove the first zero only. If you need to remove multiple zeros, change 1 to something else.

5

Pasting Data for Autoformatting

This time, we won’t be using any formulas. Instead, we will just copy/paste the data and leave it to excel for autoformatting.

Select the cells you want to remove the zeros from, and copy from the Clipboard section.

Pasting Data for Autoformatting

Select the cells where you want to paste the data. Then press Ctrl+Alt+V.
From the new dialog box, check the Add combobox from the Operation Then press OK to see the result.


If the source cells still show the copy outline, you might want to select the source cells and press Enter.


Frequently Asked Questions

How do I stop Excel from taking zeros in front of numbers?

Before writing the values, put an apostrophe (`) at the beginning. Now excel won’t take the zeros in front of your numbers.

How to keep 0 in front of number in sheet?

You have to change the format of the cells from number to Text. Then, sheets will remove zeros because otherwise, zeros in front of regular numbers don’t matter.

How do I make zeros go away in Excel?

From the File menu, go to Options > Advanced. From the “Display options for this worksheet” option, select your worksheet, and uncheck “Show a zero in cells that have zero value”.

How to paste into Excel without losing leading zeros?

Before pasting the values, format the columns where you want to paste the data into Text. Then, after pasting the data, the leading zeros will not be removed.

How do you ignore zeros in Excel average?

Use this AVERAGEIF function:
=AVERAGEIF(A1:A10,”<>0″)
Replace A1:A10 with your data range.


Wrapping Up

In this article, we have learned five ways to remove zeros in front of a number in excel. If you want to see the workbook yourself, download and open it from your device. Feel free to drop a suggestion or two below, and we will see you in another article.

ExcelInsider Team
We will be happy to hear your thoughts

Leave a reply

Excel Insider
Logo
Verified by MonsterInsights