Forum Discussion
Patrick2788
Jun 25, 2022Silver Contributor
A LAMBDA Exercise
For this exercise I stripped down a calendar template and put in some sample data. The goal is to obtain gross pay for July for 3 employees. The data arrangement: I believe there are seve...
PeterBartholomew1
Jun 26, 2022Silver Contributor
I was undecided whether to delicately unwrap the calendar format into meaningful arrays or to simply hit it with a blunt instrument, COUNTIFS in the present case. I came to the conclusion that the latter was sufficient, provided I was allowed to mark the holiday as a named range.
Worksheet formula
= rate * MAP(staff, Hoursλ);
Hoursλ = LAMBDA(s,
8 * SUM(COUNTIFS(holiday, s), dayRate * BYCOL(july, LAMBDA(day, COUNTIFS(day, s))))
);
dayRate = {1.5, 1, 1, 1, 1, 1, 1.5};
One thing that I would observe about Patrick's original solution, is that 'hours()' is a Lambda function and therefore will accept parameters directly from the helper functions without the use of an additional Lambda to pass parameters. I only realised that once I had reduced my own formula by naming its Lambda function to be "Hoursλ".