Search list and count

mm57

New Member
Joined
May 31, 2011
Messages
1
Hi, I have a problem that has been driving me crazy -
I have a list of values in a column that were recorded every two minutes.

I need to calculate the time since each particular value in the list was last equaled or exceeded.

I can do this by counting the number of cells since the value was exceeded or equaled but as I'm dealing with thousands of values in the list I need a formula that can do it.

So I want my output to look like this
<style> <!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";} @page {margin:1.0in .75in 1.0in .75in; mso-header-margin:.5in; mso-footer-margin:.5in;} td {padding:0px; mso-ignore:padding; color:black; font-size:12.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Calibri, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;} --> </style> <table style="border-collapse: collapse;width:195pt" border="0" cellpadding="0" cellspacing="0" width="195"> <col style="width:65pt" span="3" width="65"> <tbody><tr style="height:15.0pt" height="15"> <td style="height:15.0pt;width:65pt" height="15" width="65">
</td> <td style="width:65pt" width="65"> A (value)
</td> <td style="width:65pt" width="65"> B (time since)
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">9</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">8</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">7</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">6</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">5</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">4</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">5</td> <td align="right">4</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">6</td> <td align="right">8</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">7</td> <td align="right">12</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">8</td> <td align="right">16</td> </tr> </tbody></table> Any body have any ideas to help?

Thanks
<style> <!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";} @page {margin:1.0in .75in 1.0in .75in; mso-header-margin:.5in; mso-footer-margin:.5in;} td {padding:0px; mso-ignore:padding; color:black; font-size:12.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Calibri, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;} --> </style> <table style="border-collapse: collapse; width: 195pt;" border="0" cellpadding="0" cellspacing="0" width="195"> <col style="width:65pt" span="3" width="65"> <tbody><tr style="height:15.0pt" height="15"> <td style="height:15.0pt;width:65pt" height="15" width="65">
</td> <td style="width:65pt" width="65">
</td> <td style="width:65pt" width="65">
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td>
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td align="right">
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td align="right">
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td align="right">
</td> </tr> <tr style="height:15.0pt" height="15"> <td style="height:15.0pt" align="right" height="15">
</td> <td align="right">
</td> <td align="right">
</td> </tr> </tbody></table>
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi, I have a problem that has been driving me crazy -
I have a list of values in a column that were recorded every two minutes.

I need to calculate the time since each particular value in the list was last equaled or exceeded.

I can do this by counting the number of cells since the value was exceeded or
equaled but as I'm dealing with thousands of values in the list I need a
formula that can do it.

So I want my output to look like this
<STYLE> <!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";} @page {margin:1.0in .75in 1.0in .75in; mso-header-margin:.5in; mso-footer-margin:.5in;} td {padding:0px; mso-ignore:padding; color:black; font-size:12.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Calibri, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;} --> </STYLE><TABLE style="WIDTH: 195pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=195><COLGROUP><COL style="WIDTH: 65pt" span=3 width=65><TBODY><TR style="HEIGHT: 15pt" height=15><TD style="WIDTH: 65pt; HEIGHT: 15pt" height=15 width=65>

</TD><TD style="WIDTH: 65pt" width=65>A (value)

</TD><TD style="WIDTH: 65pt" width=65>B (time since)

</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>9</TD><TD>

</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>8</TD><TD>

</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>7</TD><TD>

</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>6</TD><TD>

</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>5</TD><TD>

</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>4</TD><TD>

</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>5</TD><TD align=right>4</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>6</TD><TD align=right>8</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>7</TD><TD align=right>12</TD></TR><TR style="HEIGHT: 15pt" height=15><TD style="HEIGHT: 15pt" height=15 align=right>

</TD><TD align=right>8</TD><TD align=right>16</TD></TR></TBODY></TABLE>Any body have any ideas to help?

Thanks
<STYLE> <!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";} @page {margin:1.0in .75in 1.0in .75in; mso-header-margin:.5in; mso-footer-margin:.5in;} td {padding:0px; mso-ignore:padding; color:black; font-size:12.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Calibri, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;} --> </STYLE>

Let A2:A11 the sample you posted.

Let A12 also house a 8. What result do you want to see in B12?
 
Upvote 0
Welcome to the board.
Assuming your data starts from row 1, enter the following into B2 (using ctrl+shift+enter) and copy down as far as necessary:
=IF(COUNTIF($A$1:A1,A2),(ROW()-MAX(IF($A$1:A1=A2,ROW($A$1:A1))))*2,"")
 
Upvote 0
My interpretation (with some slightly changed data). Formula in B3 copied down.

Excel Workbook
AB
1ValueTime Since
25
342
47
562
652
742
854
968
10712
118
1262
Time Since
 
Upvote 0

Forum statistics

Threads
1,224,588
Messages
6,179,743
Members
452,940
Latest member
rootytrip

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