Calculate multiple rows of data then sum the results

-Wayner-

Board Regular
Joined
Feb 8, 2008
Messages
84
Hello,

I have a feeling this may be a relatively simple one, but as someone who just never quite gets array formulas I'm struggling to work it out!

I'd like to evaluate a series of subtractions and then count the results. So I have two columns of data, each of containing 10 rows (as an example), each cell containing an integer between 1 and 10. For each row I'd like to subtract one cell from the other on that row (A1 - A2, B1- B2, etc.) then do a count based on the results at the end.

So count of results from the 10 calculations that are less than 0, between 1 and 2 etc.

I know I could do this by doing the calcs in a separate column then counting on the third column, but I feel it should be do-able in one place!

Appreciate any advice on this.

Many thanks,
Wayner
 

Some videos you may like

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,228
Office Version
  1. 365
Platform
  1. Windows
This one would work for less than 0:

=COUNT(IF(A1:A10-B1:B10<0,))

Or between 1 & 2 inclusive:

=COUNT(IF(A1:A10-B1:B10>=1,IF(A1:A10-B1:B10<=2,)))
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,228
Office Version
  1. 365
Platform
  1. Windows
Or these which don't need array entry:

=SUMPRODUCT(--(A1:A10-B1:B10<0))
=SUMPRODUCT(--(A1:A10-B1:B10>=1),--(A1:A10-B1:B10<=2))
 

-Wayner-

Board Regular
Joined
Feb 8, 2008
Messages
84
Both work fantastically - thank you for both of the quick and effective responses :)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,333
Messages
5,595,560
Members
413,996
Latest member
mabelO

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top