How to Use Excel Formulas to Classify Lunch Meal Categories in WPS Spreadsheets
Question details
The user needs Excel formulas to classify lunch orders into four categories based on entree, vegetable-side, and fruit-side totals in cells N5, T5, and Z5.

- Product
- WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- A worksheet tracks lunch order totals for the entree in N5, the vegetable side in T5, and the fruit side in Z5, and needs to automatically return the correct meal category for each order.
- Observed behavior
- The user wants a formula-driven classification instead of manually reviewing each row.
Confirm that N5 contains the entree total, T5 contains the vegetable-side total, and Z5 contains the fruit-side total. Decide whether any value greater than 0 counts as an included item or whether each cell must equal exactly 1.
Use AND comparisons to test each lunch category
Best when you want separate 1/0 or TRUE/FALSE result columns for each possible meal category.
This approach follows the core logic: a category is true only when the required item groups are present and the other item groups are absent. The double unary operator -- converts TRUE/FALSE to 1/0 for easier summing or filtering.
In an empty cell, enter =--AND(N5>0,T5>0,Z5>0). This returns 1 only when all three item groups are present.
In the next empty cell, enter =--AND(N5>0,T5=0,Z5=0). This returns 1 when only the entree total is greater than 0.
In another empty cell, enter =--AND(N5=0,T5>0,Z5=0). This returns 1 when only the vegetable-side total is greater than 0.
In the final empty cell, enter =--AND(N5=0,T5=0,Z5>0). This returns 1 when only the fruit-side total is greater than 0.

Return a single meal category label with nested IF formulas
Use when you prefer one cell to display a readable text label such as Full Lunch, Entree Only, Veggie Side Only, or Fruit Side Only.
Classify Lunch Meals Automatically in WPS Spreadsheets
Use WPS Spreadsheets to build the same AND and nested IF formulas and automatically categorize each lunch order by entree, vegetable-side, and fruit-side totals.
- 1. Open WPS Spreadsheets: Launch WPS Office, click Spreadsheets, and open the worksheet that contains N5, T5, and Z5.
- 2. Enter the classification formula: Click the cell where the classification result should appear and enter the recommended AND or nested IF formula.
- 3. Apply the formula to all rows: Press Enter, then drag the fill handle down to classify all lunch order rows automatically.
- 4. Check the results: Review a few rows and adjust >0 or =1 conditions to match whether the totals represent any item or exactly one item.

Frequently Asked Questions
Can I use these Excel formulas in WPS Spreadsheets?
Yes. WPS Spreadsheets supports the same AND, IF, and comparison operators as Excel. Open your workbook in WPS Spreadsheets and enter the formulas directly.
What does the -- before AND do in the formula?
The double unary operator -- converts the TRUE or FALSE result from AND into 1 or 0, making it easier to count, filter, or sum the category results.
How do I change the formula if each cell contains exactly one item?
Replace each >0 test with =1. For example, use =--AND(N5=1,T5=1,Z5=1) for a full lunch when each group must contain exactly one item.
How can I show a text label instead of showing 1 or 0?
Use the nested IF formula. It checks the same AND conditions and returns a text value such as Full Lunch, Entree Only, Veggie Side Only, or Fruit Side Only.
What happens if none of the four lunch categories match?
The separate AND formulas will all return 0, and the nested IF formula can return Other/Review so you can locate rows that need attention.




