Shortest Formula Challenge
20 December 2022
If our Final Friday Fix challenges don’t quite scratch your Excel itch, there are plenty of Excel challenges to be found out in the wild.
One of our analysts, Oscar, recently took part in a Reddit competition to create the shortest formula to calculate the “Manhattan Distance” between two cells in a 5x5 range.
It’s not quite the Excel World Championship, but we’d like to congratulate Oscar on his recent victory in this competition.
The formula used was as follows:
=LET(Z,1:5,X,(Z="e")-(Z="s"),ABS(SUM(COLUMN(Z)*X))+ABS(SUM(ROW(Z)*X)))
This effectively identifies the relevant column numbers and subtracts them from each other, repeats this process for rows and then sums the two figures.