Skip to main content

[Excel] How to add zero before a number in Excel

Use Apostrophe

The easiest way to add zeros in front of numbers in Excel is to add apostrophe (‘) before zeros.



This automatically converts numbers into texts so you will see a green triangle at the top-left corner of the cell indicating an error. Click “Ignore error” to proceed.

Text Formatting

You can simply change the number format to text to keep the leading zeros in numbers. To do this, follow the instructions below:


1. Right-click on the cell(s) where you want to add the leading zeros.

2. Select Format cells.


                          


3. The Format Cells dialog box will appear. Select Text from the category options.

4. Click OK.


                          

Custom Formatting

If you don't want the data to appear as text and you want to keep the number value, you may apply custom formatting. To do this, follow the instructions below:


1. Right-click on the cell(s) where you want to add the leading zeros.

2. Select Format cells.


3. The Format Cells dialog box will appear. Select Custom from the category options.

4. Enter zeros in the "Type" box. In the "Sample" box above, it will show how the value will appear in the cell.

5. Click OK.


                                

Apply Formula

TEXT Function


Example:


Where:

B2 = cell number where to get the original value
0000 = string length or the number of digits of the new value

REPT Function


Example:

Where:

0 = value (zero) to be added
2 = number of values (zeros) to be added
B2 = cell number where to get the original value
                

CONCAT Function


Example:


Where:

0000 = number of values (zeros) to be added
B2 = cell number where to get the original value

Use Ampersand


Example:


Where:

000 = number of values (zeros) to be added
B2 = cell number where to get the original value

Comments

Popular posts from this blog

[Google Sheets] Linking Data to Cell Ranges, Sheets and Another Spreadsheet

Google sheets is part of Google Workspace that organizes data in columns and rows for reporting and data analysis. In this tutorial, you will learn how to link data within tabs, between multiple tabs and from one spreadsheet to another. Before you begin To get started, go to sheets.google.com and select "blank" to open a new blank sheet. Linking Data Below are the different ways to link data in google sheets: Linking within tabs Linking between multiple tabs Linking from one spreadsheet to another Linking data within tabs 1. Click anywhere on google sheets and type anything. 2. Right-click and select Insert link. 3. Click Select a range of cells to link. 4. The "Select a data range" box will appear. 5. Select another cell within a sheet where you want to link your data. 6. Click OK . 7. Verify the cell address before you click Apply . Linking data between mul...

[Excel] How to Protect Multiple Excel Tabs with Different Passwords

Requirement:  I have an excel file with multiple tabs which is being updated monthly by many users. I want to create a password for each tab so that each user can only view and edit their own tab. Limitation : Protect Sheet Function in Excel is notoriously weak.  Solution : Use VBA code to set up password on each tab. Protecting Multiple Tabs with Different Passwords Let's say I have three teams which need to report their daily sales in one excel spreadsheet. The three teams are named Team Apple, Team Watermelon and Team Grapes. First, let's create a new tab for each one of them. 1. Add three new tabs and rename each according to the team name. 2. Create a column for 'Name', 'Item', 'Sales' and 'Date' for each team.  3. Click Visual Basic from the 'Developer' tab. 4. From Sheet 2 to Sheet 4, copy and paste the VBA code below: VBA Code: Private Sub Worksheet_Activate()     Dim strPassword As String     'On Error Resume Next        ...

[Microsoft Flow] How to Connect Microsoft Form Responses to Power BI

Requirement : Auto-import of data to Power BI when a new response in Microsoft Forms is submitted. Solution : Connect Microsoft Forms to Power BI through Microsoft Flow. Assumptions : Power BI is already installed. Microsoft Form is already created. Creating a Streaming Dataset 1. Sign into https://powerbi.microsoft.com. 2. On the Power BI homepage, click New under 'My workspace'.  3. Select Streaming dataset . 4. Select API and click Next . 5. Enter a name for your dataset. 6. Enter each question from MS Forms to 'Values from stream' in Power BI and select the type of the answer for each. 7. Click Create . 8. Turn on Historic data analysis and click Done . 9. When you click the name of your dataset under 'My workspace', you are now ready to create a Power BI report. Connecting MS Forms to Power BI 1. Log into https://flow.microsoft.com. 2. Click My flows in the left navigation bar. 3. Click New flow and select Automated cloud flow . 4. Before you create yo...