Counting Number Of Occurrences One Threshold Met Over Multiple Lines

PS_Richard

New Member
Joined
Nov 22, 2022
Messages
13
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Good morning all,

As always in advance, thanks to this wonderful site and all the extremely helpful users. Now on to the issue that I have today. I'm looking at the voltages on a device where I need to count the occurrence of times it enters idle. This is done when a state is recorded as the same voltage a minimum of 3 rows the same. Below is a hefty example of 74 lines of data but I wanted to give a clear picture of what I'm after.

What you can see here is data within columns A to G with headers on the top row. I've highlighted the sections when it needs to flag that an occurrence has happened and we need to view this on column A as being the voltage column's trigger.

BA - Idle State.xlsx
ABCDEFG
1voltagelocalTempremoteTempelectrolyteStatusdischargeCurrentchargeCurrentdateTime
286.339.139.520012/09/2022 15:43
386.339.139.420012/09/2022 15:44
485.238.839.3234.6012/09/2022 15:45
586.138.839.328.6012/09/2022 15:46
686.238.839.329012/09/2022 15:47
785.138.739.3235.1012/09/2022 15:48
887.538.539.327.3139.212/09/2022 15:49
985.838.238.721.296.112/09/2022 15:54
1085.638.138.720012/09/2022 15:55
1185.838.138.720012/09/2022 15:56
1285.83838.720012/09/2022 15:57
1385.837.838.720012/09/2022 16:01
1485.837.838.720012/09/2022 16:02
1585.837.838.720012/09/2022 16:03
1685.837.838.720012/09/2022 16:04
1785.937.838.720012/09/2022 16:05
1885.837.838.720012/09/2022 16:06
1985.837.838.720012/09/2022 16:07
2085.837.638.720012/09/2022 16:08
2185.937.638.720012/09/2022 16:09
2285.837.538.720012/09/2022 16:10
2385.837.538.720012/09/2022 16:11
2485.837.538.720012/09/2022 16:12
2585.837.538.720012/09/2022 16:13
2681.737.538.72152.515.512/09/2022 16:14
279037.538.720318.512/09/2022 16:15
2885.337.538.729.3012/09/2022 16:16
2985.537.538.728.8012/09/2022 16:17
3085.537.838.728.6012/09/2022 16:18
3185.537.738.728.6012/09/2022 16:19
3285.537.838.728.8012/09/2022 16:20
3385.537.838.729.2012/09/2022 16:21
3485.637.838.728.2012/09/2022 16:22
3585.537.838.628.6014/09/2022 16:23
3685.537.838.528.4014/09/2022 16:24
3785.537.838.428.6014/09/2022 16:25
3885.537.838.428.2014/09/2022 16:26
3985.537.838.428.6014/09/2022 16:27
4085.537.838.428.4014/09/2022 16:28
4185.537.838.328.2014/09/2022 16:29
4285.537.838.328.8014/09/2022 16:30
4385.537.838.128.2014/09/2022 16:31
4480.737.8382218014/09/2022 16:32
4585.537.238.220014/09/2022 16:39
4685.537.238.420014/09/2022 16:40
4785.537.238.420014/09/2022 16:41
4884.537.338.4232014/09/2022 16:44
4984.437.238.4228.6014/09/2022 16:45
508437.238.4241.1014/09/2022 16:46
5185.437.23820014/09/2022 17:04
5285.337.23820014/09/2022 17:05
5385.337.237.820014/09/2022 17:06
5485.437.237.720014/09/2022 17:07
5585.337.237.720018/09/2022 17:08
5685.337.137.620018/09/2022 17:09
5785.33737.520018/09/2022 17:10
5885.336.937.420018/09/2022 17:11
5985.336.937.420018/09/2022 17:12
6085.336.937.420018/09/2022 17:13
6185.336.937.420018/09/2022 17:14
6285.336.937.420018/09/2022 17:15
6385.336.937.220018/09/2022 17:16
6485.336.937.120018/09/2022 17:17
6585.336.937.120018/09/2022 17:18
6685.336.937.120018/09/2022 17:19
6785.336.937.120018/09/2022 17:20
6885.336.937.120018/09/2022 17:21
6985.336.83720018/09/2022 17:22
7085.336.73720018/09/2022 17:23
7185.336.93720018/09/2022 17:24
7285.336.836.920018/09/2022 17:25
7385.336.636.920018/09/2022 17:26
7485.336.536.820018/09/2022 17:27
Sheet1


On rows 13 - 16, the voltage is 85.8 for 4 stages so this is occurrence #1. Row #17 is just one entry so can be ignored. Then back to being checked on any additional rows.
Next are rows 18 to 20, 22 to 25, 29 to 33, 35 to 45 to 47 and then 55 to 74.

So even though the values can appear across the range it needs to be only noted once itstheyssed 3 entries. So looking at the above rows it would be a total occurrence 7. I'd then be then looking to show the results into something as follows (this is a manual edit with no formulas as that is the help I'm looking for).

BA - Idle State.xlsx
JKLM
1OccuranceNumber Of EntriesDate/Time of First EntryDate/Time of Last Entry
21412/09/2022 16:0112/09/2022 16:04
32312/09/2022 16:0612/09/2022 16:08
43412/09/2022 16:1012/09/2022 16:13
54512/09/2022 16:1712/09/2022 16:21
65914/09/2022 16:2314/09/2022 16:31
76314/09/2022 16:3914/09/2022 16:41
872018/09/2022 17:0818/09/2022 17:27
Sheet1


Hopefully this all makes sense on what I'm looking to achieve but if you need any further clarification then please let me know.

Thanks, PS_Richard
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
If it helps, I've made a helper column in the interim to see when the occurrence happens. So in cell H1, I have this: =1
Then in cell H2 copied down I have this: =IF(A2=A1,H1+1,1)

This is then doing a count and then resetting to 1 if the previous figure is not the same. So I'm getting to see where these instances are happening but it's then pulling that information across into the chart example I've given in the second part of my original post.
 
Upvote 0
I've updated my sheet and hopefully, by showing the below it'll help someone to help me.

2023-01-27 - BA eGO! Idle.xlsx
ABCDEFGHIJKLMNOPQRST
1Occurance IDSequence StartConsecutive CheckerNumber of Entries CheckervoltagelocalTempremoteTempelectrolyteStatusdischargeCurrentchargeCurrentdateTimeOccuranceNumber of EntriesVoltageDay / Time of First EntryDay / Time of Last EntryDuration
2  1 86.841.340.329.7012/09/2022 15:26185.812/09/2022 16:01
3  1 86.941.140.3210.1012/09/2022 15:27285.812/09/2022 16:06
4  2 86.940.740.129.3012/09/2022 15:28385.512/09/2022 23:59
5111 85.837.838.720012/09/2022 16:014  
6  2 85.837.838.720012/09/2022 16:025  
7  3 85.837.838.720012/09/2022 16:036  
8  4485.837.838.720012/09/2022 16:047  
9  1 85.937.838.720012/09/2022 16:058  
10211 85.837.838.720012/09/2022 16:069  
11  2 85.837.838.720012/09/2022 16:0710  
12  3385.837.638.720012/09/2022 16:08
13  1 81.737.538.72152.515.512/09/2022 16:14
14  1 9037.538.720318.512/09/2022 16:15OccuranceNumber of EntriesVoltageDay / Time of First EntryDay / Time of Last EntryDuration
15  1 85.337.538.729.3012/09/2022 16:16185.812/09/2022 16:0112/09/2022 16:0400:03:00
16311 85.537.538.728.8012/09/2022 23:59285.812/09/2022 16:0612/09/2022 16:0800:02:00
17  2 85.537.838.728.6013/09/2022 00:00385.512/09/2022 23:5913/09/2022 00:0300:04:00
18  3 85.537.738.728.6013/09/2022 00:01
19  4 85.537.838.728.8013/09/2022 00:02
20  5585.537.838.729.2013/09/2022 00:03
21  1 85.437.23820013/09/2022 00:04
Example Data
Cell Formulas
RangeFormula
A2:A21A2=IF(B2=1,COUNTIF(B$2:B2,1),"")
B2:B21B2=IF(C4=3,1,"")
C2C2=1
D2:D21D2=IF(AND(C2>=3,C3=1),C2,"")
C3:C21C3=IF(F3=F2,C2+1,1)
Q2:Q11Q2=IFERROR(VLOOKUP(O2,$A:$L,6,0),"")
R2:R11,R17R2=IFERROR(VLOOKUP(O2,$A:$L,12,0),"")
T15:T17T15=S15-R15


So from F1 to L21 is my raw data. I've added 'helper' columns in A1 to D21 and you can see the formulas I've used there to see when an occurrence happens and when the sequence starts and when it ends.

In O1 to T11 is what I currently have in my lookups to get the data from the raw. What I'm struggling with is filling in the following columns, 'Number of Entries' and 'Day / Time of Last Entry' as when I get that field in I can work out the duration.

Hope this better shows / explains what I'm after help with? Th.nks...
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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