TransWikia.com

Checking if a value is within one of many possible ranges

Web Applications Asked by Rietty on January 24, 2021

I have the following table, with two rows. The first value in each row is the "minimum difference" between terms. The rest is a series of numbers at least that far apart from each other, but could be more, for example the first few numbers in row one can also be like so: 60 | 0 60 140 210 270 ....

60  | 0 60  120 180 240 300 360 420 480 540 600
90  | 0 90  180 270 360 450 540 630 720 810 900

What my goal here is that given a few external values, offset, time and duration. I would like to check if that time falls within a specified window.

So for example:
If the offset is 4, and the duration is 15. Then I would like to check if the time falls in any of the following ranges (for example row 1):

4 - 15, 64 - 79, 124 - 139.

However one small issue I am having is I don’t know how to do the next part, which is if the values are separated by a time of minimum difference + offset or more, then we just start at the given time. And discount any offset usage after that fact. So for example:

60 | 0 60 140 200 280 ....

Then the windows would be:

4 - 15, 64 - 79, 140 - 155, 200 - 215, 280 - 295.

How can I accomplish this?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP