# Get smallest number is a sequence of data

#### TOKYOJ1

##### New Member
Hi,

I need some help to get Excel to extract all the smallest numbers [RED] in a repeating data sequence that goes from maximum to mininum and back to maximum...

 11-Jan-03 162.63 12-Jan-03 151.6 13-Jan-03 140.43 14-Jan-03 129.08 15-Jan-03 117.48 16-Jan-03 105.6 17-Jan-03 93.39 18-Jan-03 80.81 19-Jan-03 67.83 20-Jan-03 54.46 21-Jan-03 40.74 22-Jan-03 26.79 23-Jan-03 12.72 24-Jan-03 1.31 25-Jan-03 15.16 26-Jan-03 28.7 27-Jan-03 41.83 28-Jan-03 305.46 29-Jan-03 293.21 30-Jan-03 281.36 31-Jan-03 269.87 01-Feb-03 258.65 02-Feb-03 247.65 03-Feb-03 236.78 04-Feb-03 225.98 05-Feb-03 215.17 06-Feb-03 204.3 07-Feb-03 193.35 08-Feb-03 182.25 09-Feb-03 170.98 10-Feb-03 159.53 11-Feb-03 147.88 12-Feb-03 136 13-Feb-03 123.89 14-Feb-03 111.53 15-Feb-03 98.92 16-Feb-03 86.05 17-Feb-03 72.92 18-Feb-03 59.57 19-Feb-03 46.04 20-Feb-03 32.39 21-Feb-03 18.72 22-Feb-03 5.15 23-Feb-03 8.22 24-Feb-03 21.31 25-Feb-03 325.96 26-Feb-03 313.62 27-Feb-03 301.67 28-Feb-03 290.08 01-Mar-03 278.81 02-Mar-03 267.76 03-Mar-03 256.87

<tbody>
</tbody>
<strike></strike>

<tbody>
</tbody>

<tbody>
</tbody>

##### MrExcel MVP
What does "
sequence that goes from maximum to mininum and back to maximum" mean? Would you do the explanation with respect to 1.31 and 5.15?

#### shg

##### MrExcel MVP
Maybe just ...

 A​ B​ C​ D​ 13​ 22-Jan-03​ 26.79​ 0​ 14​ 23-Jan-03​ 12.72​ 0​ 15​ 24-Jan-03​ 1.31​ 1​ C15: =--(B15=MIN(B14:B16)) 16​ 25-Jan-03​ 15.16​ 0​ 17​ 26-Jan-03​ 28.70​ 0​

... which you could use as a CF formula.

#### TOKYOJ1

##### New Member
What does "
sequence that goes from maximum to mininum and back to maximum" mean? Would you do the explanation with respect to 1.31 and 5.15?
Hi,

The data is actually in degrees of rotation (360). It goes from 360 to 0 to 360 to 0 to 360.... (max to min to max to min...)
I just want to capture all the minimum angles before it goes back up again in long sequence of data.

#### mikerickson

##### MrExcel MVP
If you put =AND((SIGN((B1-B2)*(B2-B3))<0),(B2 < B1)) in B2 and drag down, it will return TRUE when B2 is a minimum relative to B1 and B3.

Last edited:

#### Rick Rothstein

##### MrExcel MVP
It is not clear what exactly you are looking for for a solution... here is a macro that will do what I think you want.
Code:
``````[table="width: 500"]
[tr]
[td]Sub HighlightMinimumValues()
Dim R As Long, Data As Variant
Data = Range("B1", Cells(Rows.Count, "B").End(xlUp))
Columns("B").Cells.Font.ColorIndex = vbBlack
For R = 2 To UBound(Data) - 1
If Data(R, 1) < Data(R - 1, 1) And Data(R, 1) < Data(R + 1, 1) Then
Cells(R, "B").Font.Color = vbRed
End If
Next
End Sub[/td]
[/tr]
[/table]``````

#### TOKYOJ1

##### New Member
If you put =AND((SIGN((B1-B2)*(B2-B3))<0),(B2 < B1)) in B2 and drag down, it will return TRUE when B2 is a minimum relative to B1 and B3.
Still testing this formula:
 20-Jan-25 54.46 FALSE 21-Jan-25 40.74 FALSE 22-Jan-25 26.79 FALSE 23-Jan-25 12.72 TRUE 24-Jan-25 1.31 FALSE 25-Jan-25 15.16 FALSE 26-Jan-25 28.7 FALSE 27-Jan-25 41.83 FALSE 28-Jan-25 305.46 FALSE

<colgroup><col><col span="2"></colgroup><tbody>
</tbody>

 Not sure why it missed by one day...

<colgroup><col><col><col></colgroup><tbody>
</tbody>

<colgroup><col><col></colgroup><tbody>
</tbody>

<colgroup><col><col span="2"></colgroup><tbody>
</tbody>

#### TOKYOJ1

##### New Member
Hi,

I got it. Formula should be in C2 instead of C1.

My sincere thanks!!!!

#### Rick Rothstein

##### MrExcel MVP
I got it. Formula should be in C2 instead of C1.
You should have said you were looking for a formula solution in your original message. Here is another formula you can consider (place it in cell C2 and copy down)...

=AND(B3<=B2,B3<=B4)

Note: If you decide to stay with Mike's formula, you might want to change both of his "less than" signs to "less than or equal" signs so that it will mark multiple adjacent exact minimum values as TRUE instead of FALSE. My formula above already handles this situation.

Last edited:

#### TOKYOJ1

##### New Member
You should have said you were looking for a formula solution in your original message. Here is another formula you can consider (place it in cell C2 and copy down)...

=AND(B3<=B2,B3<=B4)

Note: If you decide to stay with Mike's formula, you might want to change both of his "less than" signs to "less than or equal" signs so that it will mark multiple adjacent exact minimum values as TRUE instead of FALSE. My formula above already handles this situation.

Eloquent solution. My sincere thanks!

1,082,336
Messages
5,364,701
Members
400,811
Latest member
MSBINinja

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...