<< All versions
Skill v1.0.0
currentAutomated scan100/100hydr0pon1c/skills-on-the-fly/3002
──Details
PublishedNovember 19, 2026 at 01:07 PM
Content Hashsha256:5146b51ecd1617b7...
Git SHA66ffae118bc9
──Files
Files (1 file, 6.8 KB)
SKILL.md6.8 KBactive
SKILL.md · 83 lines · 6.8 KB
metadata: version: "1.0.0"
SKILL.md
When to use
This skill applies when you need to modify an existing Excel formula to work with column changes, then apply bulk formatting changes (remove all color and borders, then re-apply thin borders conditionally) while preserving other formatting. The task is cell-level: you write a formula and adjust cell styles for a specific range.
Target contract:
- You must adjust a formula (likely using
COUNTIFSorIF+COUNTIFS) to detect duplicate combinations of two columns. - The formula output should be placed in a specified answer range (e.g., G5:G15) and must display either "Multiple" or "Single" for each row based on duplicate detection.
- After writing the formula, you must first remove all color fills and borders (but keep all other formatting) from the worksheet or relevant cells.
- Then re-apply thin (all) borders to every populated cell except those whose value is "Multiple" or "Single".
Evidence to gather before acting:
- Load the workbook and inspect the first few rows to identify which columns contain "Mat Doc" and "Doc No".
- Determine the exact column indices (1‑based) for Mat Doc, Doc No, and the Remark column.
- Map the answer position range (e.g., G5:G15) to the correct column and rows.
- Check if the spreadsheet contains any existing color fills, borders, or other formatting you must remove.
- Understand the target range row count – the formula should be written into each cell of that range (copy‑down style).
Possible Failure Modes
- Wrong column indices – Using the wrong column letter in the formula because you mis‑matched the header names in the spreadsheet content.
- Formula errors – Using an incorrect syntax for
COUNTIFS(e.g., mixing row ranges, using relative vs absolute references incorrectly). The formula must be written as an Excel formula string, not computed in Python. - Forgetting to strip borders completely – You may only remove fills but leave borders, or only remove borders from the answer range instead of the whole sheet. The instruction says “remove all color and border formatting” – this likely applies to the entire sheet (or at least all cells that might have formatting).
- Conditional border re‑application fails – You may apply thin borders to cells that have "Multiple" or "Single", which is prohibited.
- Over‑preserving other formatting – You might accidentally remove font styles, alignment, or number formats when removing color and borders. Use
cell.fill = PatternFill(fill_type=None)andcell.border = Border()while not touching other properties. - Answer position mis‑placement – The formula must be placed exactly in the cells given by
answer_position(e.g., G5:G15). Writing it outside that range or not filling all cells in that range will fail. - Treating the formula as a computed value in Python – The instruction explicitly asks for an Excel formula adjustment, not a Python‑computed result. Writing numeric values instead of formulas will not match the requirement.
Possible procedures
- Load the workbook and inspect data
- Use
openpyxl.load_workbook(input_path). - Read the header row to confirm which columns are Mat Doc and Doc No.
- Determine the last row of data (e.g., find non‑empty cells in the data columns).
- Verify the answer range: output column index, start row, end row (e.g., column G = 7, rows 5 to 15).
- Write the formula
- The formula should be of the form:
=IF(COUNTIFS($<MatDocCol>$<startRow>:$<MatDocCol>$<endRow>,<current Mat Doc cell>, $<DocNoCol>$<startRow>:$<DocNoCol>$<endRow>,<current Doc No cell>)>1,"Multiple","Single")
- Use absolute references for the range (e.g.,
$C$5:$C$100), and relative reference for the current row (e.g.,C5). - Ensure the range covers all data rows (not just the answer range).
- Set the formula string for each cell in the answer range sequentially.
- For cells beyond the first, the relative reference to the current cell automatically adjusts when you copy the formula string (you can write the same formula string for all cells, or adjust the relative part if needed).
- Remove all color and border formatting
- Iterate over all cells that have any fill or border (or simply all cells with data/formatting).
- Use
cell.fill = PatternFill(fill_type=None)to clear fills. - Use
cell.border = Border()(i.e., a default empty border) to remove all borders. - Do not modify font, alignment, number_format, or other properties.
- If the instruction says “remove all color and border formatting” without specifying a scope, it is safest to clear formatting on the entire sheet’s data range (or the whole used range). The retrieved examples show that excessive clearing can cause issues, so only clear fills and borders.
- Re‑apply thin all borders conditionally
- Create a
Side(style='thin')and build aBorder(left=side, right=side, top=side, bottom=side). - Iterate over every cell that has a value (cell.value is not None).
- If the cell value is not the string "Multiple" and not the string "Single", set
cell.border = thin_border. - Leave cells with "Multiple" or "Single" without any border (they will keep the border you cleared in step 3, i.e., no border).
- Important: Do not re‑apply borders to empty cells – only to “all populated cells”.
- Ensure the thin border is applied only after the clearing step, so there is no double‑border or residual formatting.
- Save the workbook
- Write to the provided
output_path. - If the output directory does not exist, create it with
os.makedirs.
Verification Checklist
- [ ] The formula is placed exactly in the cell range given by
answer_position(e.g., G5:G15). - [ ] Every cell in that range contains a valid Excel formula string, not a computed value.
- [ ] The formula references the correct columns for Mat Doc and Doc No (matching the header names).
- [ ] No color fills remain anywhere in the workbook (check a sample of cells).
- [ ] No borders remain on any cell before re‑application (i.e., all borders cleared).
- [ ] Thin borders are applied to every cell that:
- Has a non‑None value, and
- The value is not exactly "Multiple" or "Single".
- [ ] Cells whose value is "Multiple" or "Single" have no border (the cleared state).
- [ ] Other formatting (font, alignment, number format, column width) is unchanged.
- [ ] The output file can be opened and recalculated without errors.
- [ ] The solution does not copy any hard‑coded values, paths, or numeric constants from retrieved examples.
- [ ] If the workbook contains multiple sheets, only the target sheet is modified unless the instruction explicitly states otherwise.