Skip to content

Instantly share code, notes, and snippets.

@ExcelRobot
Last active April 29, 2024 06:13
Show Gist options
  • Save ExcelRobot/e6c313a5708b3c3fa97208530e4c66da to your computer and use it in GitHub Desktop.
Save ExcelRobot/e6c313a5708b3c3fa97208530e4c66da to your computer and use it in GitHub Desktop.
MEWC No Examples Lambda
/*
Name: No Examples (NoExamples)
Description: Given the used range of a MEWC (Microsoft Excel World Championship) Case sheet, returns just the game numbers, levels, and game data excluding any example data.
Parameters:
used_range - Reference to all used cells on Case sheet.
Source: Excel Robot (@ExcelRobot)
*/
NoExamples =LAMBDA(used_range, LET(
\\LambdaName, "NoExamples",
\\CommandName, "No Examples",
\\Description, "Given the used range of a MEWC (Microsoft Excel World Championship) Case sheet, returns just the game numbers, levels, and game data excluding any example data.",
\\Parameters, {"used_range", "Reference to all used cells on Case sheet."},
\\Source, "Excel Robot (@ExcelRobot)",
_ColsToRemove, {3, 4},
fnRemoveBlanks, LAMBDA(array, LET(
_NonBlanks, (--ISBLANK(array) + (array = "")) = 0,
_NonBlankColumns, FILTER(
SEQUENCE(1, COLUMNS(_NonBlanks)),
BYCOL(--_NonBlanks, LAMBDA(x, SUM(x))) <> 0
),
_NonBlankRows, FILTER(
SEQUENCE(ROWS(_NonBlanks)),
BYROW(--_NonBlanks, LAMBDA(x, SUM(x))) <> 0
),
Result, CHOOSEROWS(
CHOOSECOLS(IF(array = "", "", array), _NonBlankColumns),
_NonBlankRows
),
Result
)),
_AllData, fnRemoveBlanks(IF(ISBLANK(used_range), "", used_range)),
_Keep, ISNUMBER(TAKE(_AllData, , 1)) * ISNUMBER(INDEX(_AllData, , 2)),
fnRemoveCols, LAMBDA(array, column_indexes,
CHOOSECOLS(
array,
FILTER(
SEQUENCE(1, COLUMNS(array)),
ISERROR(
MATCH(SEQUENCE(1, COLUMNS(array)), TOROW(column_indexes), 0)
)
)
)
),
_GameData, fnRemoveCols(FILTER(_AllData, _Keep), _ColsToRemove),
_Result, VSTACK(
EXPAND({"Game #", "Level", "Data"}, , COLUMNS(_GameData), ""),
_GameData
),
_Result
));
@eoehm
Copy link

eoehm commented Apr 29, 2024

If you are not familiar with the Microsoft Excel World Championship, sign up and give it a try: https://fmworldcup.com/excel-esports/microsoft-excel-world-championship/

In these competitions, it's common to have bonus questions that ask about the data provided for the case questions but excluding the data for the examples. Using this lambda will save you time on getting just the data for the question rows. I also included the game numbers and levels to make it easy to filter on just specific levels.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment