Looking for a formula that takes a min and max value, then generates a delimited list of numbers including and between those values.
For example:
min = 2015
max = 2017
result = 2015,2016,2017
Not sure what to call it/how to word it, everything I've tried gives me results unrelated.
CodePudding user response:
You may try
=TEXTJOIN(",",,SEQUENCE(1,3,2015,1))
CodePudding user response:
After help from @Mayukh Bhattacharya, I was able to accomplish my desired output by using his suggested macro for SEQUENCE
alone.
Function SEQUENCE(min As Integer, max As Integer, steps As Integer) As String
Dim i As Integer
For i = min To max Step steps
SEQUENCE = SEQUENCE & i & ","
Next i
SEQUENCE = Left(SEQUENCE, Len(SEQUENCE) - 1)
End Function
Written as =SEQUENCE(1987,1990,1)
gave me 1987,1988,1989,1990