1

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.

Casey
  • 55
  • 7

2 Answers2

2

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

Casey
  • 55
  • 7
1

You may try

=TEXTJOIN(",",,SEQUENCE(1,3,2015,1))
Mayukh Bhattacharya
  • 12,541
  • 5
  • 21
  • 32