About this exercise
Write one Google Sheets formula for W2 (filled down) that gives each student's attendance rate from the day codes in C2:V2. School policy: P and T (tardy) both count as present, H (holiday) days don't count at all, and blank days haven't happened yet. The report card import needs text like 93.8%, so wrap the result in TEXT with one decimal. One formula in one code block, then under 25 words outside the code.
Common mistakes when you ask AI for this
- Not giving the tardy rule. The AI counts only P as present, so tardy students look absent. Try: Add: "P and T both count as present."
- Not mentioning holidays and blanks. The AI divides by every column, so holidays and future days drag rates down. Try: Add: "H days and blanks don't count in the total."
- Leaving the format open. The AI returns 0.9375, which the import can't read. Try: Add: "Return text like 93.8% using TEXT."
- Getting a menu of options. The AI likes to offer two or three versions of the formula, so you're left to pick and test them yourself. Try: Add: "Give one formula only, in one code block, no alternatives."
- Getting a tutorial. By default the AI explains every part of the code at length, which you then have to scroll past. Try: Add: "After the code, one line under 10 words. Nothing else."
What a strong prompt includes
- Gives the tardy rule
- Excludes holidays and blanks
- Sets the output format
- Asks for one answer only
- Limits the explanation
Related exercises
- Add a cron line that matches the others in a crontab (Coding AI · Product managers)
- Add dark mode by overriding your existing CSS variables (Coding AI · Software developers)
- Add input checks to your number guessing game (Coding AI · High school students)
- Add input validation to a Java method with exact messages (Coding AI · Software developers)
- Add labels to a signup form without rewriting the page (Coding AI · High school students)