Formula for counting how many times value in cells above are higher.

Jitka

New Member
Joined
Jul 31, 2018
Messages
24
Hi
I wonder if any of you experts could point me in the right direction please? I've tried with no success.

I have a spreadsheet with staff names across various quarters, I also have a column that indicates which quarter was first and which last. I need to compare row with first and last quarter, and count how many times the value is higher in the last quarter compared to first quarter in cells C-E.
So the data looks something like this at the moment
In the column D (for all rows that are 'last' period) I'd like the result of how many time the number was higher.
All the rows in between that are not marked first or last are to be ignored.
Each staff need to have their data counted separately.
1ABCDED
2Staffperiod ShoesDressesTrousersTotal number that matches the criteria (column C-E) having value higher in the row marked as 'last' quarter against 'first' quarter
3PoppinsFirst233
4Poppins154
5PoppinsLast437
6StarFirst431
7Star126
8Star144
9StarLast545

<tbody>
</tbody>

Thank you so much.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Just for clarification purposes could you please input the values in column D that this set of data would give.

For example would the value of D5 be 2, as the staff member Poppins has values of Shoes and Trousers that are larger than in the first period? Then D9 would be 3 as Star has all 3 values higher?
 
Upvote 0
Hi

yes that's exactly what I need. unfortunately I can't edit the table now to add it in but yes, because Poppins increased the number on 2 occasion the result in D5 would be 2.
and the same for Star, the D9 would = 3.
Thank you
 
Upvote 0
OK, and will the data always be in order of staff member? So all the Poppins, then all Star.
Or will it be random
 
Upvote 0
Jitka,
I added one helper column D with this formula dragged down. This makes reference to the row with the last "First" period.
="C"&ROW(INDIRECT(CELL("address",INDEX($B$2:$B2,MATCH("First",$B$2:$B2)))))&":E"&ROW(INDIRECT(CELL("address",INDEX($B$2:$B2,MATCH("First",$B$2:$B2)))))
Then this formula in the next column.
<c4:e4)),"")
<c4:e4)),"")
<c4:e4)),"")
=IF(B4="Last",SUMPRODUCT(--(INDIRECT(F4)<C4:E4)),"")
OGCV</c4:e4)),"")
</c4:e4)),"")
</c4:e4)),"")
 
Last edited:
Upvote 0
That last formula should be:
Code:
IF(B4="Last",SUMPRODUCT(--(INDIRECT(F4)"<"C4:E4)),"")
Just remove the quotation marks from the "<" it wont post that bit with out them
 
Last edited:
Upvote 0
Hi OGCV1

Thanks very much for your time on this. I'll give it a go today. I would really like to learn basic index match formula, is there a good point to start at, do you know?
Jitka
 
Upvote 0
Hi I noticed an error on my original sheet but I think you accounted for this. I put the number or rows 1 row higher than I should have, I put in where the column markers are i.e. A,B...

sorry.
 
Upvote 0
Hi again,

I tried this out on the test sheet and also my real one but I can't get it to work. I pasted the first formula in a new column, dragged down and got C2:E2 returned instead of a value. Then I pasted the other formula in another column, tried both with the quotation marks and without and got this returned IF(B4="Last",SUMPRODUCT(--(INDIRECT(F4)<C4:E4)),"")
Not sure where I am going wrong?
 
Upvote 0

Forum statistics

Threads
1,214,884
Messages
6,122,082
Members
449,064
Latest member
MattDRT

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