How to Correctly Sum Numbers With Units in a Range in Excel?
Last Updated :
21 Mar, 2022
In Excel, we can sum numbers in a range which are given along with their units. When we place numbers along with their units inside Excel then they are treated as text by Excel implicitly in the backend. Now, the problem that arises here is we cannot directly apply any mathematical function like the in-built SUM() function over texts to get their sum because the SUM() will always return us a value 0.

We can observe from the image given above, when we use the =SUM(B2:B6), to sum text values then we get the result as 0. From this we now have an understanding that to add numbers using the SUM() function, we need to have numerical values i.e., the number data type for each element in the cell range. To convert these texts back to numbers we need to perform two steps:
Step 1: Remove the units (here, km) from the elements.
It can be done using the SUBSTITUTE() function in Microsoft Excel. The SUBSTITUTE() function in Excel is used to substitute specific values inside a text string with a new value. The syntax for the SUBSTITUTE() function is given as:
=SUBSTITUTE(original_text, old_text, new_text, [instance_num])
where original_text is the element/record value, it is a required parameter, old_text is the string value you want to substitute inside the original_text, it is a required parameter, new_text is the string value that will replace the old_text, it is a required parameter, and instance_num is an optional parameter that specifies the appearance number of old_text in the original_text that we want to substitute with the new_text.
Example:

Here, we used the SUBSTITUTE() function to substitute the text “km” with nothing, therefore, used “" with no characters inside the double quotes. Thus, removing “km” from the entire text and getting 20 as the output which is still a text value.
Step 2: Convert the text back to the number data type.
Now we can perform any mathematical operation with this text value to convert it back to number type hence we can add 0 to the text thus it will not affect its value.

Now that we know how we can convert these text values back to numbers we will perform this operation for the whole-cell range as:

Step 3: Using SUM() function to sum all the numbers along with their units
After converting all the text back to number format we can use the basic SUM() function to add these numbers as can be seen from the image given below. We use the SUM() function on values from C2:C6 to get the final result.
So this is how we correctly sum numbers with units in a range in Excel.
Similar Reads
How to Sum Numbers With Commas in a Single Excel Cell? In Excel, we can add different comma-separated numbers that are present in the same cell of an excel sheet. Look at the example below, there are 5 comma-separated numbers in cell A2 and we have to sum them up. Comma-separated values in a single cell Let us see the various ways in which we can add th
3 min read
How to Sum Diagonal Cells in a range in Excel? The calculation of matrices is one of the most difficult numerical computation tasks. You may need to add values diagonally in a table when performing mathematical computations. Excel allows you to sum diagonal numbers without having to add the values one by one. We'll go through how to sum cells di
6 min read
Custom Format to Show Units Without Changing Number to Text in Excel Microsoft Excel is a great software that is used by individuals to store data in the form of spreadsheets in a formatted manner. Microsoft Excel allows us to store a variety of data such as characters, text, numbers, decimals, date, time, etc. Since Excel is a smart tool, it automatically identifies
3 min read
How to Put Count and Percentage in One Cell in Excel? In the real world, sometimes the user would like to present two or more values in a single cell. For eg in the sales report, we might need sales and the respective %share in the same cell. So in this article, we will learn how to display count and percentage in the same cell with the help of an exam
2 min read
How to calculate Sum and Average of numbers using formulas in MS Excel? Everyday in school, offices, business sectors or any other field lots of information are there that are required to store for future use. For anyone, it is very difficult to remember that information for a long time. Earlier data and information are stored in a form of a register, file, or by paperw
4 min read
How to Convert Scientific Notation to Text or Number in Excel? Microsoft Excel is a universal software tool that is used by companies throughout the world to store data/numbers in the form of a spreadsheet. Excel not only helps users to store the data into spreadsheets, but it also gives us the freedom to use multiple smart features to manipulate, organize and
5 min read
How to calculate Sum of Digits in a Number using Non Array Formulas in Excel? In Excel, we can easily add the digits of a number. Usually, calculations that involve multiple values can be dealt with the help of array formulas, but here, we are going to find the sum of the digits of a number using non-array formulas. As an example, say we have a number 238 in one of the cells
4 min read
How to Round Numbers in Excel? Precision is important, but so is clarity. Whether you're preparing a financial report, managing inventory, or analyzing sales data, knowing how to round numbers in Excel can streamline your spreadsheets and make your data easier to understand. Excel offers several functions tailored for different r
13 min read
How to Sum a Column in Excel: 3 Methods Knowing how to sum a column in Excel is essential for managing budgets, financial reports, and large datasets. Whether youâre calculating sales totals, adding expenses, or analyzing business data, Excel provides multiple ways to add up a column efficiently. Many users wonder "how to add columns in E
5 min read
How to Calculate a Five Number Summary in Excel? In statistics, the five-number summary is mostly used as it gives a rough idea about the dataset. It is basically a summary of the dataset describing some key features in statistics. The five key features are : Minimum value: It is the minimum value in the data setFirst Quartile, Q1: It is also know
3 min read