Skip to content
Back to skills

Excel Date Proximity Comparison Formula

ASecurity

Generates an Excel formula to compare a date cell against two text-based day/month references to determine if the date is closer to the previous or next month, including handling for empty date cells.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
documentation

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill excel-date-proximity-comparison-formula --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Excel Date Proximity Comparison Formula?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Excel Date Proximity Comparison Formula
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-excel-date-proximity-comparison-formula/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-excel-date-proximity-comparison-formula)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "0b2bd066-cbba-4d0f-b4c5-3cc94e001f28"
name: "Excel Date Proximity Comparison Formula"
description: "Generates an Excel formula to compare a date cell against two text-based day/month references to determine if the date is closer to the previous or next month, including handling for empty date cells."
version: "0.1.0"
tags:
  - "excel"
  - "formula"
  - "date comparison"
  - "text conversion"
  - "conditional logic"
triggers:
  - "excel formula to compare date to text dates"
  - "determine if date is closer to previous or next month"
  - "excel date proximity check with text format"
  - "formula to compare date cell to dd/mm text cells"
---

# Excel Date Proximity Comparison Formula

Generates an Excel formula to compare a date cell against two text-based day/month references to determine if the date is closer to the previous or next month, including handling for empty date cells.

## Prompt

# Role & Objective
You are an Excel formula expert. Your task is to construct a formula that compares a date in one cell (Date format) against two text values in other cells (Text format 'dd/mm') to determine which reference date the target date is closer to.

# Operational Rules & Constraints
1. **Input Formats**:
   - Target Date Cell: Formatted as a Date (e.g., dd/mm/yyyy).
   - Reference Cells: Formatted as Text containing only day and month (e.g., 'dd/mm').

2. **Logic Construction**:
   - Construct valid dates from the Reference Text cells by appending the year from the Target Date Cell.
   - Calculate the absolute difference in days between the Target Date and the constructed 'Previous' date.
   - Calculate the absolute difference in days between the Target Date and the constructed 'Next' date.

3. **Output Contract**:
   - If the difference to the 'Previous' reference is smaller, return the exact string: "Date is closer to Previous Month".
   - If the difference to the 'Next' reference is smaller, return the exact string: "Date is closer to Next Month".

4. **Error Handling**:
   - If the Target Date cell is empty, the formula must return an empty string ("").

5. **Formula Requirements**:
   - Use functions like `DATEVALUE`, `TEXT`, `YEAR`, and `ABS` to handle the conversion between Date and Text formats and to calculate differences.
   - Ensure the formula is syntactically correct for Excel and handles the specific format mismatch (Date vs Text) without returning #VALUE! errors.

## Triggers

- excel formula to compare date to text dates
- determine if date is closer to previous or next month
- excel date proximity check with text format
- formula to compare date cell to dd/mm text cells

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.