0

I am using Excel version 2205 (Build 15225.20356)

I expect that each of these functions produces the identical result $A$1

// no lambda or let
=ADDRESS(ROW(A1),COLUMN(A1))

// lambda alone
=LAMBDA(cell, ADDRESS(ROW(cell), COLUMN(cell)))(A1)

// let alone
=LET(
    cell,
    A1,

    f,
    ADDRESS(ROW(cell), COLUMN(cell)),
    
    f
)

// let and lambda (version 1)
=LET(
    cell,
    A1,

    f,
    LAMBDA(x,
        ADDRESS(ROW(x), COLUMN(x))
    ),

    f(cell)
)

// let and lambda (version 2)
=LET(
    cell,
    A1,

    f,
    LAMBDA(x,
        ADDRESS(ROW(cell), COLUMN(x))
    ),

    f(cell)
)

The last function produces a #VALUE! error. Why?


EDIT: here's an example that does something similar, but does work as expected. Assume $A$1=1, then this will output 2

=LET(
    cell,
    A1,

    f,
    LAMBDA(x, cell + x),

    f(cell)
)
4
  • Because, LET() function can preserve only calculated result not function. You define f for lambda function which is not possible inside LET() function. Name manager can work in this type fashion. Commented Jul 27, 2022 at 1:58
  • @Harun24hr - I define a LAMBDA function inside a LET in 2 other examples that work as expected. Why is the last example different? Commented Jul 27, 2022 at 12:50
  • In the last case what is cell referring to in the portion ROW(cell)? Essentially you have a typo as x is defined as a function over cell but cell itself is undefined within the context of the LAMBDA function. I assume it should read ADDRESS(ROW(x), COLUMN(x)) Commented Jul 28, 2022 at 20:40
  • @Tragamor - The example directly above that is as you say. The failure case an intentionally trivial example intended to show the error. The LAMBDA() function fails when it uses both a variable from the LET and from the lambda-expression. Commented Jul 28, 2022 at 21:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.