Sequence of values (numer, dates, times etc) with multiple criteria.

HighAndWilder

Well-known Member
Joined
Nov 4, 2006
Messages
1,004
Office Version
  1. 365
Platform
  1. Windows
Given that I have a sequence of values, times in this case, I'd like to produce what is in column F and G as a sequence from F2 to F16 and G2 to G16.

I don't want to have to work out where the formula needs to be placed (F4 and G4).

In this scenario there are two criteria (>=01:03:00 and <=01:16:00 ) but I want to be able to enhance such a formula to include multiple criteria.

The 'Value Here' value could be the result of another formula or hard coded.

How could I do this?

Thanks.

REGEXEXTRACT.xlsm
ABCDEFGH
1
201:03:0001:16:0001:00:00
301:02:00
401:04:0001:04:00Value Here
501:06:0001:06:00Value Here
601:08:0001:08:00Value Here
701:10:0001:10:00Value Here
801:12:0001:12:00Value Here
901:14:0001:14:00Value Here
1001:16:0001:16:00Value Here
1101:18:00
1201:20:00
1301:22:00
1401:24:00
1501:26:00
1601:28:00
17
18
Sheet6
Cell Formulas
RangeFormula
E2:E16E2=SEQUENCE(15,1,TIME(1,0,0),1/720)
Dynamic array formulas.
 
Hello, would something like this be on the right track:

Excel Formula:
=LET(
s,E2:E16,
c,(s>=B2)*(s<=C2),
v,"Value Here",
IF(c,HSTACK(s,IF(SEQUENCE(ROWS(s)),TOROW(v))),""))
 
Last edited:
Upvote 0
I'm not clear what values you actually want in column G, can you explain?

Note that using SEQUENCE like that for a sequence of time values may result in floating point errors which could affect any calculations based on those values, better to use a dragged down formula in E2 like this:

=TIME(1,2*(ROWS(E$2:E2)-1),0)
 
Upvote 0
As Barry has pointed out, the formula in col E could cause problems. Another option is
Fluff.xlsm
DEH
1
201:00:0001:00:00TRUE
301:02:0001:02:00TRUE
401:04:0001:04:00TRUE
501:06:0001:06:00TRUE
601:08:0001:08:00TRUE
701:10:0001:10:00TRUE
801:12:0001:12:00TRUE
901:14:0001:14:00TRUE
1001:16:0001:16:00TRUE
1101:18:0001:18:00TRUE
1201:20:0001:20:00TRUE
1301:22:0001:22:00FALSE
1401:24:0001:24:00FALSE
1501:26:0001:26:00TRUE
1601:28:0001:28:00TRUE
Data
Cell Formulas
RangeFormula
D2:D16D2=TIME(1,SEQUENCE(15,,0,2),0)
E2:E16E2=SEQUENCE(15,1,TIME(1,0,0),1/720)
H2:H16H2=D2=E2
Dynamic array formulas.


As can be seen in col H the times don't all match
 
Upvote 0
As Barry has pointed out, the formula in col E could cause problems. Another option is
Fluff.xlsm
DEH
1
201:00:0001:00:00TRUE
301:02:0001:02:00TRUE
401:04:0001:04:00TRUE
501:06:0001:06:00TRUE
601:08:0001:08:00TRUE
701:10:0001:10:00TRUE
801:12:0001:12:00TRUE
901:14:0001:14:00TRUE
1001:16:0001:16:00TRUE
1101:18:0001:18:00TRUE
1201:20:0001:20:00TRUE
1301:22:0001:22:00FALSE
1401:24:0001:24:00FALSE
1501:26:0001:26:00TRUE
1601:28:0001:28:00TRUE
Data
Cell Formulas
RangeFormula
D2:D16D2=TIME(1,SEQUENCE(15,,0,2),0)
E2:E16E2=SEQUENCE(15,1,TIME(1,0,0),1/720)
H2:H16H2=D2=E2
Dynamic array formulas.


As can be seen in col H the times don't all match
Thanks Barry And Fluff.

I was only using times as an example but it was good that I did.

I will use the column D method in future.

Thanks.
 
Upvote 0

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