L_SE
=L_SE(start, end)
Argument | Description | Example |
---|---|---|
start | The start value (integer or character) in the sequence | 2 or "B" |
end | The end value (integer or character) in the sequence (can be < start) | 4 or "E" |
In the template file, navigate to the Sequences worksheet to see the L_SE function in action.
Description
The L_SE function provides a shortcut for creating a sequence of integers or characters by just specifying the start value and end value. The end value can be less than the start value.
This can be accomplished with the SEQUENCE function as shown below, but the SE function shortcut is more concise.
L_SE(start,end) = SEQUENCE(ABS(end-start),1,start,SIGN(end-start)) L_SE(2,5) = {2;3;4;5}
When the start and end values are characters, the L_SE function uses the UNICODE and UNICHAR functions to first convert the characters to their UNICODE values. It then creates the sequence and converts it back to characters using UNICHAR.
L_SE("Z","X") = {"Z";"Y";"X"}
Lambda Formula
This code for using L_SE in Excel is provided under the License as part of the LAMBDA Library, but to use just this function, you may copy the following code directly into your spreadsheet.
Code to Create Function via the Name Manager
Name: L_SE Comment: Create a sequence of integers or characters between start and end Refers To: =LAMBDA(start,end, LET(doc,"https://www.vertex42.com/lambda/se.html", IF(ISNUMBER(start), SEQUENCE(ABS(end-start)+1,1,start,SIGN(end-start)), UNICHAR(SEQUENCE(ABS(UNICODE(end)-UNICODE(start))+1,1,UNICODE(start),SIGN(UNICODE(end)-UNICODE(start)))) ) ))
Code for AFE Workbook Module (Excel Labs Add-in)
/** * Create a sequence of integers or characters between start and end */ L_SE = LAMBDA(start,end, LET(doc,"https://www.vertex42.com/lambda/se.html", IF(ISNUMBER(start), SEQUENCE(ABS(end-start)+1,1,start,SIGN(end-start)), UNICHAR(SEQUENCE(ABS(UNICODE(end)-UNICODE(start))+1,1,UNICODE(start),SIGN(UNICODE(end)-UNICODE(start)))) ) ));
Named Function for Google Sheets
Name: L_SE Description: Create a sequence of integers or characters between start and end Arguments: start, end Function: =LET(doc,"https://www.vertex42.com/lambda/se.html", IF(ISNUMBER(start), SEQUENCE(ABS(end-start)+1,1,start,SIGN(end-start)), ARRAYFORMULA(UNICHAR(SEQUENCE(ABS(UNICODE(end)-UNICODE(start))+1,1,UNICODE(start),SIGN(UNICODE(end)-UNICODE(start))))) ) )
L_SE Examples
=L_SE("a","z") RESULT: {"a";"b";"c";"d";"e";"f";"g";"h";"i";"j";"k";"l";"m";"n";"o";"p";"q";"r";"s";"t";"u";"v";"w";"x";"y";"z"} =L_SE("A","Z") RESULT: {"A";"B";"C";"D";"E";"F";"G";"H";"I";"J";"K";"L";"M";"N";"O";"P";"Q";"R";"S";"T";"U";"V";"W";"X";"Y";"Z"}
=L_SE("⚀","⚅") RESULT: {"⚀";"⚁";"⚂";"⚃";"⚄";"⚅"}
See Also
SE, LINSPACE, LOGSPACE, RESCALE, MESHGRID