Forum Discussion
anupambit1797
May 16, 2023Iron Contributor
How to create a Latin Square in Excel
Dear Experts,
Could you please help explain on how can we create a Latin-Square in Excel?
An n x n Latin Square is a Latin square consists of sets of the numbers 1 to n arranged in such a way that no orthogonal (row or column) contains the same number twice. Example ,the 12 Latin squares of order three are given by :-
Thanks in Advance,
Br,
Anupam
Here's my solution. I've attached a sample workbook.
'LatinSquare =LAMBDA(n,MAKEARRAY( n, n, LAMBDA(r, c, LET( seq, SEQUENCE(, n), arr, HSTACK(TAKE(seq, , -(r - 1)), TAKE(seq, , n - (r - 1))), IF(r = 1, c, INDEX(arr, , c)) ) ) ))
1 Reply
- Patrick2788Silver Contributor
Here's my solution. I've attached a sample workbook.
'LatinSquare =LAMBDA(n,MAKEARRAY( n, n, LAMBDA(r, c, LET( seq, SEQUENCE(, n), arr, HSTACK(TAKE(seq, , -(r - 1)), TAKE(seq, , n - (r - 1))), IF(r = 1, c, INDEX(arr, , c)) ) ) ))