Crispo - Excel Challenge 21 2024

excel-challenges
weekly-exercises
Easy Sunday Excel Challenge
Published

May 26, 2024

Illustration for Crispo - Excel Challenge 21 2024

Challenge Description

Easy Sunday Excel Challenge

⭐ Date Amount Last Name Greg Beth

Solutions

library(tidyverse)
library(readxl)

input = read_excel("files/Excel Challenge 26th May.xlsx", range = "C2:E20")
test  = read_excel("files/Excel Challenge 26th May.xlsx", range = "I2:K7")

result = input %>%
  na.omit() %>%
  tail(5)

all.equal(result, test, check.attributes = FALSE)
# [1] TRUE
  • Logic:

    • Reads the workbook range needed for the challenge
  • 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

input = pd.read_excel("files/Excel Challenge 26th May.xlsx", usecols="C:E", skiprows = 1, nrows = 18)
test  = pd.read_excel("files/Excel Challenge 26th May.xlsx", usecols="I:K", skiprows = 1, nrows = 5)

result = input.dropna().tail(5).reset_index(drop=True)
result["Amount"] = result["Amount"].astype("int64")
test.columns = input.columns

print(result.equals(test)) # True
  • Logic:

    • Reads the workbook range needed for the challenge
  • 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 easy to moderate:

  • The business rule is readable, but the workbook still needs a few careful transformation steps.