Counting Increases and Decreases

Agent86

Board Regular
Joined
Feb 28, 2003
Messages
229
I have table in which every week a new set of numbers is inserted in the next available column to the right. At the top of each column I'd like to calculate two things ...

1. The number of cells that have a larger number than the prior week's number on the same row.

2. The number of cells that have a smaller number than the prior week's number on the same row.

I can't seem to figure our a formula that will do that. Any ideas? Perhaps a code solution?

Thank you for your help.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You can use a formula like

=COUNTIF(range, "<" & someCell)

... but I don't undertsnd your data layout well enough to identify the range or the cell of interest.
 
Upvote 0
Say last week's data is in cells C3:C100 and this week's data in cells D3:D100. Then in D1 enter this and confirm with ctrl + shift + enter (not just enter):
Code:
=SUM(IF($D$3:$D$100>$C$3:$C$100,1,0))
This will count the number of data points for this week that are greater than last week's companion point. In D2 enter the same formula except change the > sign to "<" (w/o the quotes) to get the number of points less than last week's companion points.
 
Upvote 0
Thanks shg4421. I'll try to do a better job of describing.

Currently my data range is G6:H463. Each row represents the value of a specific item. Each column is a week ending date. Essentially I'm trying to monitor how many items are increasing in value and how many are decreasing in value each week.

With that in mind, in H1 I'd like to calculate the number of cells in Column H that have a "larger" number than the number on their respective row in Column G. In H2 I'd like to calculate the number of cells in Column H that have a "smaller" number than the number on their respective row in Column G.

Every week another column will be added. So next week I will add data to Column I and look for increases and decreases compared to Column H.

Thank you for your assistance.
 
Upvote 0
Does this do what you want?

In H1: =SUMPRODUCT(--(H6:H500 > G6:G500))

In H2: =SUMPRODUCT(--(H6:H500 < G6:G500))
 
Upvote 0
Thank you shg4421. That works equally well. I've tried to use SUMPRODUCT on a few occasions, but have never been comfortable with it. Guess it's very worth my studying up on.
 
Upvote 0

Forum statistics

Threads
1,222,749
Messages
6,167,958
Members
452,158
Latest member
MattyM

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
Back
Top