Count occurrences - Backwards compatible solutions

morrowj04

New Member
Joined
Oct 8, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I require a spreedsheet that count how many at a particular time.

It works in the newest version of excel but i cant seem to get it to work on excel prior to the newest version.

Ive tried various ways and still cant get the formula to work correctly.

Test Rota.xlsx
GH
3
403004
504004
605005
706008
8070010
9080010
1009007
1110005
1211005
1312005
1413005
1514002
1615002
1716002
1817002
1918002
2019002
2120002
2221000
Sheet1
Cell Formulas
RangeFormula
H4H4=SUMPRODUCT(COUNT(IF(LEFT($A$2:$A$27,2)=LEFT(G4,2),1,""))-COUNT(IF(RIGHT($A$2:$A$27,2)=LEFT(G4,2),1,"")))
H5:H22H5=SUMPRODUCT(COUNT(IF(LEFT($A$2:$A$27,2)=LEFT(G5,2),1,""))-COUNT(IF(LEFT(RIGHT($A$2:$A$27,4),2)=LEFT(G5,2),1,"")))+H4
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I realise i never uploaded the full dataset

Test Rota.xlsx
ABCDE
2
30300-0900
40300-090003004
50300-090004004
60730-213005005
70600-140006008
80500-1000070010
9080010
100600-140009007
1110005
1211005
1312005
140300-100013005
1514002
1615002
170700-120016002
181200-210017002
190630-143018002
2019002
2120002
2221000
23
24
Sheet1
Cell Formulas
RangeFormula
D4D4=SUMPRODUCT(COUNT(IF(LEFT($A$2:$A$27,2)=LEFT(C4,2),1,""))-COUNT(IF(RIGHT($A$2:$A$27,2)=LEFT(C4,2),1,"")))
D5:D22D5=SUMPRODUCT(COUNT(IF(LEFT($A$2:$A$27,2)=LEFT(C5,2),1,""))-COUNT(IF(LEFT(RIGHT($A$2:$A$27,4),2)=LEFT(C5,2),1,"")))+D4
 
Upvote 0
Why does 2100 have a 0 result? In your chart there is a 2100 and a 2130, so I would think it would be 2.
 
Upvote 0
Why does 2100 have a 0 result? In your chart there is a 2100 and a 2130, so I would think it would be 2.

The reason this happens is because the first half adds on and the second half subtracts


Start TimeEnd Time
03002100


i havent yet but the overhanging If statement that corrects that behaviour :)
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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