How can I require a roster row to have both a name and a shift before it is accepted?
Quick answer
Use a custom data-validation rule that accepts a row only when both the name and shift cells are blank, or when both are filled. For example, if the name is in A2 and the shift is in B2, use =OR(AND($A2="",$B2=""),AND($A2<>"",$B2<>"")). Apply it to the intended entry range, adjust the references for your layout, and test blank, complete, and partly filled rows. Excel supports custom validation formulas. [S1]
The question, the details, the next step.
A practical checklist
Identify the Name and Shift columns and the first roster row.
Use a rule that permits both cells blank or both cells filled.
Apply the rule to the intended entry range and verify its cell references.
Test a blank row, a complete row, a name-only row, and a shift-only row.
Test a later row and separately define any rules for approved shift choices.
A few more useful answers
Does “Ignore blank” by itself require both fields?
No. It controls handling of blank values in Excel’s validation settings; it is not a substitute for explicitly expressing the two acceptable row states. [S1]
Will this rule check whether the shift is a valid shift name?
No. It checks whether both cells are empty or both are nonempty. A separate rule is needed if shifts must come from an approved list.
What if my name and shift columns are not A and B?
Replace the example references with the cells in your layout and use the first row covered by the rule as the starting row. Test the rule on several rows in your workbook.
Sources
References used for this guide.
- [S1] Apply data validation to cells in Excel support.microsoft.com · Checked
