ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   how to calculate number ranges (https://www.excelbanter.com/excel-worksheet-functions/24458-how-calculate-number-ranges.html)

Lori

how to calculate number ranges
 
I am trying to calculate how many total numbers appear in a range of numbers.
The first 2 columns would have the beginning and end numbers for the range.
If there is only 1 number for the range it would appear in the first column
and the second column would be blank. (When I use the formula B1-A1+1 I get
a negative number in third column instead of a 1.)

Any help would be greatly appreciated.

1500 1504 5
1505 1
1506 1508 3
1509 1
1512 1515 4
1516 1

N Harkawat

=IF(B1="",1,B1-A1+1)*ISNUMBER(A1)


"Lori" <Lori @discussions.microsoft.com wrote in message
...
I am trying to calculate how many total numbers appear in a range of
numbers.
The first 2 columns would have the beginning and end numbers for the
range.
If there is only 1 number for the range it would appear in the first
column
and the second column would be blank. (When I use the formula B1-A1+1 I
get
a negative number in third column instead of a 1.)

Any help would be greatly appreciated.

1500 1504 5
1505 1
1506 1508 3
1509 1
1512 1515 4
1516 1




Lori

Thank you. This is exactly what I needed.

"N Harkawat" wrote:

=IF(B1="",1,B1-A1+1)*ISNUMBER(A1)


"Lori" <Lori @discussions.microsoft.com wrote in message
...
I am trying to calculate how many total numbers appear in a range of
numbers.
The first 2 columns would have the beginning and end numbers for the
range.
If there is only 1 number for the range it would appear in the first
column
and the second column would be blank. (When I use the formula B1-A1+1 I
get
a negative number in third column instead of a 1.)

Any help would be greatly appreciated.

1500 1504 5
1505 1
1506 1508 3
1509 1
1512 1515 4
1516 1






All times are GMT +1. The time now is 06:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com