# Search tidal data

#### MLC12345

##### New Member
Hi,

I have a database of tidal data, i.e. the time with corresponding tide level, every 5 min a day. If you plot this data, you get a sinusoidal curve. I would like to be able to input a certain day + tide level and get the times back in which the tide is lower than this level. For example;
input: 09/09/14; 2.4m
output: from 0:05 to 9:25 and from 12:00 to 21:20

So this means that between 0:05 and 9:25 the tide is lower than 2.4m and between 12:00 and 21:20 the tide is again lower than 2.4m.
Since there are 2 high tides a day, I should always get 2 time intervals... I will also sometimes get 2.5 time intervals (e.g. if the tide is low again at midnight).

Help on this one would be greatly appreciated...

Thanks!
Marie

### Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hi Marie

My suggestion assumes that your Dates are in column A, Time in column B and Tide Level in column C.
And if your input date is in cell E2, and Tide Level in cell F2, then try this array formula (must be confirmed with Ctrl+Shift+Enter)
If you need more than 5000 rows then adjust the formula accordingly.

="From "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 < F2,\$B\$2:\$B\$5000)),1),"h:mm")&" to "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 > F2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$241=E2,IF(\$C\$2:\$C\$241 < F2,\$B\$2:\$B\$241)),1),\$B\$2:\$B\$5000))),1),"h:mm")&", and from "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=\$E\$2,IF(\$C\$2:\$C\$5000 < \$F\$2,IF(\$B\$2:\$B\$5000 > =SMALL(IF(\$A\$2:\$A\$241=E2,IF(\$C\$2:\$C\$241 > F2,IF(\$B\$2:\$B\$241 > SMALL(IF(\$A\$2:\$A\$241=E2,IF(\$C\$2:\$C\$241 < F2,\$B\$2:\$B\$241)),1),\$B\$2:\$B\$241))),1),\$B\$2:\$B\$5000))),1),"h:mm")&" to "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=\$E\$2,IF(\$C\$2:\$C\$5000 > \$F\$2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$241=\$E\$2,IF(\$C\$2:\$C\$241 < \$F\$2,IF(\$B\$2:\$B\$241 > SMALL(IF(\$A\$2:\$A\$241=E2,IF(\$C\$2:\$C\$241 > F2,IF(\$B\$2:\$B\$241 > SMALL(IF(\$A\$2:\$A\$241=E2,IF(\$C\$2:\$C\$241 < F2,\$B\$2:\$B\$241)),1),\$B\$2:\$B\$241))),1),\$B\$2:\$B\$241))),1),\$B\$2:\$B\$5000))),1),"h:mm")&IFERROR(", and from "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=\$E\$2,IF(\$C\$2:\$C\$5000 < \$F\$2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$241=\$E\$2,IF(\$C\$2:\$C\$241 > \$F\$2,IF(\$B\$2:\$B\$241 > SMALL(IF(\$A\$2:\$A\$241=\$E\$2,IF(\$C\$2:\$C\$241 < \$F\$2,IF(\$B\$2:\$B\$241 > SMALL(IF(\$A\$2:\$A\$241=E2,IF(\$C\$2:\$C\$241 > F2,IF(\$B\$2:\$B\$241 > SMALL(IF(\$A\$2:\$A\$241=E2,IF(\$C\$2:\$C\$241 < F2,\$B\$2:\$B\$241)),1),\$B\$2:\$B\$241))),1),\$B\$2:\$B\$241))),1),\$B\$2:\$B\$241))),1),\$B\$2:\$B\$5000))),1),"h:mm"),"")

Vidar

Last edited:
If you need more than 5000 rows then adjust the formula accordingly.
Vidar

I noticed that not all my ranges went to row 5000. So here is the edited formula. Remember to confirm with Ctrl+Shift+Enter.

="From "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 < F2,\$B\$2:\$B\$5000)),1),"h:mm")&" to "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 > F2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 < F2,\$B\$2:\$B\$5000)),1),\$B\$2:\$B\$5000))),1),"h:mm")&", and from "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=\$E\$2,IF(\$C\$2:\$C\$5000 < \$F\$2,IF(\$B\$2:\$B\$5000 > =SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 > F2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 < F2,\$B\$2:\$B\$5000)),1),\$B\$2:\$B\$5000))),1),\$B\$2:\$B\$5000))),1),"h:mm")&" to "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=\$E\$2,IF(\$C\$2:\$C\$5000 > \$F\$2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$5000=\$E\$2,IF(\$C\$2:\$C\$5000 < \$F\$2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 > F2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 < F2,\$B\$2:\$B\$5000)),1),\$B\$2:\$B\$5000))),1),\$B\$2:\$B\$5000))),1),\$B\$2:\$B\$5000))),1),"h:mm")&IFERROR(", and from "&TEXT(SMALL(IF(\$A\$2:\$A\$5000=\$E\$2,IF(\$C\$2:\$C\$5000 < \$F\$2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$5000=\$E\$2,IF(\$C\$2:\$C\$5000 > \$F\$2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$5000=\$E\$2,IF(\$C\$2:\$C\$5000 < \$F\$2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 > F2,IF(\$B\$2:\$B\$5000 > SMALL(IF(\$A\$2:\$A\$5000=E2,IF(\$C\$2:\$C\$5000 < F2,\$B\$2:\$B\$5000)),1),\$B\$2:\$B\$5000))),1),\$B\$2:\$B\$5000))),1),\$B\$2:\$B\$5000))),1),\$B\$2:\$B\$5000))),1),"h:mm"),"")

THANK YOU VIDAR! It works perfectly! You're welcome Replies
6
Views
203
Replies
9
Views
144
Replies
3
Views
262
Replies
8
Views
373
Replies
1
Views
321

### Forum statistics

1,203,269
Messages
6,054,476
Members
444,727
Latest member
Mayank Sharma ### 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.

### Which adblocker are you using?    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

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