Excel date proximity comparison formula
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8/excel-date-proximity-comparison-formula
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill excel-date-proximity-comparison-formulaAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
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.
SKILL.md
2.6 KB, as published. Nobody here has run it
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
-
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').
-
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.
-
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".
-
Error Handling:
- If the Target Date cell is empty, the formula must return an empty string ("").
-
Formula Requirements:
- Use functions like
DATEVALUE,TEXT,YEAR, andABSto 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.
- Use functions like
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