library(tidyverse)
library(readxl)
path <- "2026-02-15/Challenge 103.xlsx"
input <- read_excel(path, range = "B2:B13")
test <- read_excel(path, range = "D2:D13")
result <- input %>%
mutate(
n = row_number() - 1,
.by = Invoice,
`Suffixed Invoice` = if_else(
n == 0,
Invoice,
paste0(Invoice, "_D", str_extract(Invoice, "\\d+"), "-", n)
)
) %>%
select(`Suffixed Invoice`)
all.equal(result$`Suffixed Invoice`, test$`Suffixed Invoice`)
# Inconsitent second delim in test data, but otherwise correct.Crispo - Excel Challenge 07 2026
excel-challenges
weekly-exercises
Easy Sunday Excel Challenge

Challenge Description
Easy Sunday Excel Challenge
⭐ ⭐Suffix include Invoice “D” + Invoice digit + Duplicate Count
Solutions
Logic:
Reads the workbook range needed for the challenge
Builds the intermediate helper columns that drive the final answer
Uses direct text-pattern extraction instead of manual cleanup
Strengths:
- The R solution stays compact and mirrors the workbook logic closely.
Areas for Improvement:
- The code assumes the workbook layout and named ranges remain stable.
Gem:
- The best part of the solution is choosing a tidy intermediate shape before producing the final answer.
import pandas as pd
path = "2026-02-15/Challenge 103.xlsx"
input = pd.read_excel(path, usecols="B", skiprows=1, nrows=12)
test = pd.read_excel(path, usecols="D", skiprows=1, nrows=12)
c = input.groupby("Invoice").cumcount()
result = pd.DataFrame({
"Suffixed Invoice": input["Invoice"].where(
c.eq(0),
input["Invoice"] + "_D" +
input["Invoice"].str.extract(r"(\d+)")[0] +
"-" + c.astype(str)
)
})
print(result.equals(test))
# Inconsitent second delim in test data, but otherwise correct.Logic:
Reads the workbook range needed for the challenge
Aggregates or ranks values at the correct grouping level
Strengths:
- The Python version keeps the same rule in a direct pandas-oriented workflow.
Areas for Improvement:
- As with the R version, any workbook layout change would require small adjustments.
Gem:
- The implementation stays close to the stated challenge instead of adding unnecessary complexity.
Difficulty Level
This task is moderate:
It combines familiar Excel-style logic with at least one non-trivial reshape, grouping, or parsing step.
The answer depends on getting the output layout exactly right.