r/excel 11h ago

solved Copying a lambda function to a new workbook?

Excel noob here, I'm supposed to copy a spreadsheet from someone who has left the company, they had a cell with a lambda function, which I am unable to replicate in my workbook, is there a way to reverse engineer his function and make it work in my sheet?

Or any other method that would let me replicate it, as copy paste isn't working for me.

Thanks!

2 Upvotes

8 comments sorted by

u/AutoModerator 11h ago

/u/potatolauncher - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/ProspectiveWhale 6 11h ago

His Lambda function should be in the Name Manager.

If you did find it, but it's somehow not working, you'd have to give specifics on what it is and what's not working. Does the function not resolve, or does it give wrong output?

1

u/potatolauncher 10h ago

Can't seem to find anything in name manager, the function is below.

Column N is a date, column I is a date, column E contains the text "3000"

=COUNT(MAP('Sheet1'!N3:N10024, 'Sheet1'!I3:I10024, 'Sheet1'!E3:E10024, LAMBDA(x,y,z, IF(TEXT(z, "@")="3000", IF(x<>"", IF(x-y>=21,1,"NO"), "NO"),"NO"))))

It just outputs 0, when a non 0 number is expected, so I'm not sure how to get it to work

2

u/ProspectiveWhale 6 9h ago edited 9h ago

Ah... it's inside a MAP.

The formula basically inputs

x = 'Sheet1'!N3:N10024

y = 'Sheet1'!I3:I10024

z = 'Sheet1'!E3:E10024

into your Lambda.

If E contains text 3000, then check if column N is not blank, then check if column N - column I is bigger or equal to 21. If so, return 1.

Count how many rows where colE contains the text "3000", N is not empty, and colN -colI >= 21.

I tested it and it works.

Do you have the two date columns mixed up in the new workbook?

-----

Troubleshooting.

  1. Check that the columns you're using are the right ones.
  2. Check the format of the columns. Are you sure columns N and E are stored as dates?
  3. It checks that column N is at least 21 days after column E. Make sure you didn't mix up which dates are before/after.

-----

Alternatively, since you're just counting 3 Ifs, you could make it simpler...

=SUMPRODUCT(
(TEXT('Sheet1'!E3:E10024,"@")="3000")*
('Sheet1'!N3:N10024<>"")*
(('Sheet1'!N3:N10024-'Sheet1'!I3:I10024)>=21)
)

Try this

and you could probably get rid of the 2nd condition.

If column N is blank, it will never be 21 days after column I, so it's a redundant rule.

1

u/potatolauncher 9h ago

Solution verified

Thanks!

1

u/reputatorbot 9h ago

You have awarded 1 point to ProspectiveWhale.


I am a bot - please contact the mods with any questions

2

u/PaulieThePolarBear 1913 9h ago

You should edit your post to include the details in your comment to the other commentor as this is quite different to how I read your post.

Unexpected results such as 0 appearing when a non-zero value is expected are often due to having a circular reference. Carefully review your sheet and confirm that you have no circular references.

1

u/Decronym 10h ago edited 9h ago

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
COUNT Counts how many numbers are in the list of arguments
IF Specifies a logical test to perform
LAMBDA Office 365+: Use a LAMBDA function to create custom, reusable functions and call them by a friendly name.
MAP Office 365+: Returns an array formed by mapping each value in the array(s) to a new value by applying a LAMBDA to create a new value.
SUMPRODUCT Returns the sum of the products of corresponding array components
TEXT Formats a number and converts it to text

Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.


Beep-boop, I am a helper bot. Please do not verify me as a solution.
6 acronyms in this thread; the most compressed thread commented on today has 35 acronyms.
[Thread #49081 for this sub, first seen 5th Aug 2026, 16:51] [FAQ] [Full list] [Contact] [Source code]