Forum Discussion

枫谷剑仙's avatar
枫谷剑仙
Occasional Reader
Nov 14, 2025

Potential Bug: SEQUENCE Function Misbehaves with Dynamic start Parameter from BYROW/LAMBDA

Dear Microsoft Excel Team,

 

I’m encountering unexpected behavior when using SEQUENCE inside a BYROW/LAMBDA construction, specifically when the start parameter of SEQUENCE is derived from the lambda variable.

Environment:

Microsoft® Excel® 适用于 Microsoft 365MSO (版本 2510 Build 16.0.19328.20190) 64 位

Steps to Reproduce:

  1. The following formula works correctly and returns two identical rows:

    =BYROW({4;3}, LAMBDA(p, LET(n, 4, TEXTJOIN(" ",, SEQUENCE(5,,1,n))) ))

    Output:

    1 5 9 13 17 1 5 9 13 17
  2. However, when replacing the literal 1 with a variable derived from p (even after forcing numeric conversion), the output becomes incorrect:

    =BYROW({4;3}, LAMBDA(p, LET(n, 4, k, p + 0, TEXTJOIN(" ",, SEQUENCE(5,,k,n))) ))

    Actual Output:

    4 3

    Expected Output:

    4 8 12 16 20 3 7 11 15 19

This suggests that SEQUENCE is not correctly interpreting k (which should be 4 and 3) as the starting value. Instead, it appears to output the value of k itself as a scalar string.

Based on community reports, this may be related to the fact that BYROW always passes each row as an array—even for single-cell rows—and the value is not automatically unwrapped to a true scalar

. While p + 0 should coerce to a number, SEQUENCE’s start parameter may not be handling 1×1 arrays correctly.

Could you please clarify if this is intended behavior or a bug? If it’s by design, is there a reliable workaround to extract a true scalar from the LAMBDA parameter for use in SEQUENCE?

 

Best regards,

Mapaler

2 Replies

  • Patrick2788's avatar
    Patrick2788
    Silver Contributor

    This is what Excel sees with 'k'

    =BYROW(
        {4; 3},
        LAMBDA(p, LET(n, 4, k, p + 0, joined, TEXTJOIN(" ", , SEQUENCE(5, , k, n)), TYPE(k)))
    )
    
    output:
    64
    64
    
    Workaround:
    =BYROW({4; 3}, LAMBDA(p, LET(n, 4, k, p + 0, TEXTJOIN(" ", , SEQUENCE(5, , @k, n)))))
    

     

  • Hecatonchire's avatar
    Hecatonchire
    Iron Contributor

    Hello.

    It's not a bug, but a trap!

    Simplified version of the formula.

    =BYROW({4;3}, LAMBDA(p,TEXTJOIN(" ",, SEQUENCE(5,,INDEX(p;1),4))))

     The SEQUENCE function expects a value for the Start argument, but it's an array of one value. Therefore, you need to extract the value from the array with INDEX.

Resources