Excel BI - Excel Challenge 691

excel-challenges
excel-formulas
🔰 Answer Expected Student Score Rank1 Rank2 S1 S2 S3 S4 S5
Published

March 24, 2026

Illustration for Excel BI - Excel Challenge 691

Challenge Description

🔰 Answer Expected Student Score Rank1 Rank2 S1 S2 S3 S4 S5

Solutions

library(tidyverse)
library(readxl)

path = "Excel/691 Ranking.xlsx"
input = read_excel(path, range = "A2:B15")
test  = read_excel(path, range = "C2:D15")

result = input %>%
  mutate(Rank1 = dense_rank(Score)) %>%
  mutate(Rank2 = row_number()/100 + Rank1, .by = Rank1) %>%
  select(Rank1, Rank2)

all.equal(result, test)
#> [1] TRUE
  • Logic: Read the workbook ranges needed for the challenge; Derive the required intermediate columns; Aggregate or rank the data at the required grouping level.
  • Strengths: The code maps the workbook rule into a compact, reproducible pipeline.
  • Areas for Improvement: The solution assumes the workbook layout and selected ranges remain stable, so any structural change in the sheet would require small adjustments.
  • Gem: The elegant part is how little code is needed once the correct intermediate representation is chosen.
import pandas as pd
from scipy.stats import rankdata

path = "691 Ranking.xlsx"

input = pd.read_excel(path, usecols="A:B", skiprows=1, nrows=14)
test = pd.read_excel(path, usecols="C:D", skiprows=1, nrows=14)

input['Rank1'] = rankdata(input['Score'], method='dense').astype("int64")
input['Rank2'] = input.groupby('Rank1').cumcount() + 1
input['Rank2'] = input['Rank1'] + input['Rank2'] / 100

result = input[['Rank1', 'Rank2']]

print(result.equals(test)) # True

The Python version follows the same grouped logic and keeps the transformation explicit in a dataframe pipeline.

Difficulty Level

Easy / Medium

The business rule is clear, though the workbook still needs a few transformation steps to reach the expected output.