## Sum numerical ranges

This article explains how to build an array formula that sums ranges. Example, I want to know how to calculate the total sum between x.2 -x.3 and x.5-x.8 and the range is 0.5 and 4.5.

This picture shows you how to manually sum the ranges x.2-x.3 and x.5-x.8 between 0.5 and 4.5.

The range starts at 0.5 so 0.2-0.3 is 0. 0.5-0.8 is 0.3. Total sum between 0.5-1 is 0.3.

1.2-1.3 is 0.1 and 1.5-1.8 is 0.3. Total sum between 1-2 is 0.4.

2.2-2.3 is 0.1 and 2.5-2.8 is 0.3. Total sum between 2-3 is 0.4.

3.2-3.3 is 0.1 and 3.5-3.8 is 0.3. Total sum between 3-4 is 0.4.

4.2-4.3 is 0.1 and 4.5-4.8 is 0 because the range ends at 4.5. Total sum between 4-4.5 is 0.1.

The grand total is 1.6 (0.3+0.4+0.4+0.4+0.4+0.1 = 1.6).

### Building the array formula

First task is to build an array that returns this range 0.5 to 4.5 with increments by 0.1, like this {0.6; 0.7; ... 4.3; 4.4; 4.5}.

We only need the decimal part of the values in this array.

The array becomes {0.6; 0.7; ... 0.3; 0.4; 0.5}

The MOD function returns the decimal part of a number, unfortunately it returns a floating point error. The ROUND function takes care of that.

Second task is to build the ranges. We are going to use the FREQUENCY function and therefore we need to be more specific regarding the ranges.

The picture shows not only 0.2-0.3 and 0.5-0.8 but also other ranges before, between and after. We are not interested in those ranges but they are required in order to get the FREQUENCY function to work as we want.

It is now time to use the frequency function with our array and our ranges:

The array formula returns an array shown in D15:D20. The range we are using is 0.5 to 4.5, remember? 4.5 - 0.5 is 4. 4 is supposed to be equal to the sum of the frequency values in D15:D20. Lets verify that, 1.2+0.4+0.8+1.2+0.4 = 4. Correct.

The third task is to sum the ranges we need. In order to do that I have built a new column "Count", 1 for a range I want in the sum and 0 for a range I don´t want.

Lets multiply the array formula with the "Count" column (E15:E19):

This formula returns {0; 0.4; 0; 1.2; 0; 0}.

Then use the SUM function to sum the values in the array:

returns 1.6. 0.4 + 1.2 is 1.6, it matches the manual calculation we did in the beginning of this blog post.

### Final thoughts

Why would you want to sum numerical ranges? Consider that date and time values are actually numbers in excel, get it?

### Download excel *.xlsx file

### Category: Sum function

Identify numbers in sum using solver

Here is a useful feature I recently found googling for Excel solver examples. I have summed some random values from […]Comments(48) Filed in category: Combinations, Excel, Solver, SUM function

Sum values between two dates with criteria in excel

In this post, I will provide a formula to sum values in column (Qty) where an column (Date) meets two […]Comments(27) Filed in category: Excel, SUM function

Sum values in a range where adjacent cell value equals a criterion in excel

Question: How do I sum all values in a range where adjacent cell value equals a criterion? The criterion is […]Comments(19) Filed in category: Excel, SUM function

Comments(13) Filed in category: Excel, MMULT function, Permutations, SUM function

Comments(7) Filed in category: Count values, Excel, MMULT function, SUM function

Excel udf: Find positive and negative amounts that net to zero

I created/modified an udf to solve his question: Find positive and negative amounts that net to zero in excel Question:I would […]Comments(5) Filed in category: Excel, SUM function

Comments(2) Filed in category: Check-boxes, Excel, SUM function

Excel udf: Find numbers in sum

This article describes how to find a sum from a range of numbers using a user defined function. Let´s see […]Comments(2) Filed in category: Excel, Finance, SUM function

Sum adjacent values using multiple lookup text values in a column in excel

Here is a follow up to this previous post: Vlookup with 2 or more lookup criteria and return multiple matches […]Comments(1) Filed in category: Excel, SUM function, Vlookup

### 2 Responses to “Sum numerical ranges”

### Leave a Reply

**How to add a formula to your comment:**

<code>your formula</code>

**How to add VBA code to your comment:**

[vb 1="vbnet" language=","]

VBA code

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org

Add picture link to comment.

**Contact Oscar**

You can contact me through this webpage

[…] Read the full article here: Sum Numerical Ranges […]

Well, for anyone who is that form that have may well considering this could be piece

of cake and also you won't want any agario hack like a perfect within this game.