Question: To summarize the work you have done above, write a function Percentages _ CSA using a LAMBDA that inputs a column of names ( e

To summarize the work you have done above, write a function Percentages_CSA using a LAMBDA
that inputs a column of names (e.g., season names) and produces a row of percentages for the
alphabetically sorted unique names. The percentages specify the fraction of total rows containing
a unique name (e.g., Winter). Test your function with the Season data in the Festivals worksheet.
Notice that the length of the row of percentages depends on the data and needs to be computed
dynamically. Use two implementations to write your function Percentages_CSA, the first using
FILTER and the second using the function Percentages_from_0_1_table_CSA given below. We
give you almost a complete FILTER solution because FILTER will be covered in detail in the next
topic. Call the function with the FILTER implementation Percentages_FILTER_CSA. Call the
function with the 0_1_table as an intermediate result Percentages_0_1_table_CSA.
=LAMBDA(Names,LET(
SortedUnique,SORT(UNIQUE(UNKNOWN_1)),
CountOne,LAMBDA(s,ROWS(FILTER(Names,Names=s))),
CountsFILTER,MAP(SortedUnique, UNKNOWN_2),
Percentages,CountsFILTER/SUM(UNKNOWN_3),
Show,IFERROR(HSTACK(SortedUnique,CountsFILTER,Percentages),""),
Result,TRANSPOSE(CHOOSECOLS(Show,1,3)),
Result))({"Winter";"Summer";"Winter";"Spring";"Fall";"Winter";"Summer"})
You complete this LAMBDA by changing UNKNOWN_1, UNKNOWN_2, UNKNOWN_3 to the
correct names. For example, UNKNOWN_1 needs to be the formal argument Names.
To test the function CountOne, I used the following LAMBDA.
=LAMBDA(Names,LET(
Comment1,"FunctionToTest",
CountOne,LAMBDA(s,ROWS(FILTER(Names,Names=s))),
PartialResult1, Names="Winter",
PartialResult2,FILTER(Names,Names="Winter"),
Test_1, CountOne("Winter"),
Test_2, CountOne("Summer"),
ArrayHeaders,HSTACK("*Names","*PartialResult1","*PartialResult2","*Test_1","*Test_2"),
Show,IFERROR(VSTACK(ArrayHeaders,
HSTACK(Names,PartialResult1, PartialResult2, Test_1, Test_2)),""),
Show))({"Winter";"Summer";"Winter";"Spring";"Fall";"Winter"})
The above LAMBDA for testing uses one Names column with six rows to show partial results
inside CountOne and run CountOne for "Winter" and "Summer". Your LAMBDA should look
like LAMBDA(Names, LET(...)), where in the LET, you compute the intermediate results that
eventually lead to the final result. Document your function Percentages_FILTER_CSA using the
design recipe linked in the syllabus prefix.
To simplify the implementation of your function Percentages_0_1_table_CSA, we provide you
with a function called Percentages_from_0_1_table_CSA. It takes a table of 0 and 1 as input,
and it returns the percentage of the sum of all 1s per column across all columns.
=LAMBDA(T_0_1, LET(
counts,BYCOL(T_0_1,LAMBDA(D,SUM(D))),
percentages,counts/SUM(counts),
percentages))
Learning to understand a formula written by someone else is a common task. Your task is to
learn from the Excel documentation or ChatGPT how BYCOL is defined and to use it to imple-
ment Percentages_CSA by first producing a table of 0 and 1 and then processing it with Percent-
ages_from_0_1_table_CSA. In other words, we break Percentages_CSA into two steps: producing
and consuming a table of 0 and 1.
Put the function Percentages_from_0_1_table_CSA into a separate worksheet but you dont have
to formally document it using the design recipe.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!