size = 5
M = matrix(NA_integer_, 2*size + 1, 2*size + 1)
M[size + 1, ] = c(-size:-1, 0, 1:size)
M[, size + 1] = c(size:1, 0, -1:-size)
idx = which(is.na(M), arr.ind = TRUE)
M[idx] = ifelse(idx[,1] + idx[,2] == size + 1 | idx[,1] - idx[,2] == size + 1, -size,
ifelse(idx[,1] + idx[,2] == 3 * (size + 1) | idx[,2] - idx[,1] == size + 1, size, NA))
MExcel BI - Excel Challenge 813
excel-challenges
excel-formulas
🔰 Generate X and Y axes of all 4 quadrants for value given in A1.

Challenge Description
🔰 Generate X and Y axes of all 4 quadrants for value given in A1. Example shown is for value 4 & 5.
Solutions
- Logic: Apply the business rule conditions explicitly.
- Strengths: The code maps the workbook rule into a compact, reproducible pipeline.
- Areas for Improvement: The approach is compact, but it depends on the workbook following the same input structure as the supplied challenge file.
- Gem: The elegant part is how little code is needed once the correct intermediate representation is chosen.
import numpy as np
size = 8
M = np.full((2 * size + 1, 2 * size + 1), np.nan, dtype=float)
M[size, :] = np.arange(-size, size + 1)
M[:, size] = np.concatenate((np.arange(size, 0, -1), [0], np.arange(-1, -size - 1, -1)))
idx = np.argwhere(np.isnan(M))
for i, j in idx:
if i + j == size or i - j == size:
M[i, j] = -size
elif i + j == 3 * size or j - i == size:
M[i, j] = size
print(M)The Python version keeps the algorithm explicit, which helps when the challenge depends on a greedy or iterative rule.
Difficulty Level
Easy / Medium
The business rule is clear, though the workbook still needs a few transformation steps to reach the expected output.