3.14 AND, OR, NOT and SWITCH
Combine conditions to match the decision you need
A quick-commerce analyst gets two requests. The operations lead wants completed Pune deliveries that took ten minutes or less. The support lead wants order rows marked Cancelled or Returned. Both requests use several facts from the same order file. The first requires all of its tests to pass. The second allows either of two statuses. Writing the wrong combination changes who appears in the report.
Use fictional order rows from the course's Blinkit and Amazon Now practice dataset. City names, order IDs, amounts and recorded timings support learning rather than describing live operations. In one lab you will test true and false cases for a report filter. In the other you will map an ID prefix or city name to a label, and deliberately send unknown entries for review.
- AND. Require every listed condition when all of them matter.
- OR. Allow at least one condition to qualify, including occasions when several are true.
- NOT. Reverse a clearly defined condition. Check which cases the reversal includes.
- SWITCH. Look at one expression, match an explicit value and return its paired result.
Read the TRUE and FALSE results before adding labels
Start with two simple yes-or-no questions that you can test in a sheet. Is an order ready for collection? Is its payment confirmed? AND(ready,paid) gives TRUE only when both answers are true. OR(ready,paid) gives TRUE whenever at least one answer is true. Matching both is also a true OR case.
Make each argument an explicit test
Excel worksheet syntax uses =AND(B2="Ready",C2="Paid"). Each condition is a separate argument. Avoid entering conversational phrases inside the formula such as B2="Ready" AND C2="Paid". Begin by writing each comparison as its own expression if you are learning or debugging its meaning. A complete Boolean formula can return TRUE or FALSE directly and can become the condition passed to an IF function.
Rather than passing a range of untested business labels to a logical function, check the intended value for each field. AND and OR may ignore text or empty cells in reference or array arguments, which is different from asking whether those inputs contain a recognised label. A plain comparison and an explicit data-quality result make the spreadsheet's intent visible.
Ready is true and Paid is false. Which combination succeeds?
OR succeeds because there is at least one true condition. AND fails because Paid is false. To decide whether a package may leave, you need the exact business rule about readiness and payment.
Use AND when every condition is required
For the operations report, use three facts from the course worksheet. Column C has City, column H has numeric delivery minutes and column I has Status. For a validated row, =AND(C2="Pune",H2<=10,I2="Delivered") says the order is in Pune, it is within ten minutes, and its status is Delivered. The 10 condition includes a measured value of 10. A short recorded time on a cancelled row does not satisfy the third test.
Verify each criterion independently
For this policy, a fast Pune row qualifies only after checking Delivered. A 9-minute delivery in Nashik fails the city test even though its status and timing qualify. A Pune row with 11 minutes fails the duration test. A Pune row with 8 minutes and a Cancelled status fails the final test. Those three false cases matter because each proves a different condition is necessary.
| City | Minutes | Status | Qualifies? | Reason |
|---|---|---|---|---|
| Pune | 10 | Delivered | TRUE | Every condition qualifies. |
| Nashik | 9 | Delivered | FALSE | City is different. |
| Pune | 11 | Delivered | FALSE | Duration exceeds the limit. |
| Pune | 8 | Cancelled | FALSE | Status does not qualify. |
Wrap the Boolean result in an IF when a human needs a label. For example, =IF(AND(C2="Pune",H2<=10,I2="Delivered"),"Fast Pune delivery","Other") returns one of two text categories for clean data. If a record has an empty or invalid delivery time, validate it first. Its display does not tell you whether the service actually measured a zero or failed to provide a time.
Should an 8-minute Pune row with Cancelled status pass?
No. The time and city qualify, but the status breaks one of the required conditions. Requiring the completion status prevents a fast-looking cancellation from entering the delivery measure.
Use OR for any allowed condition
The support lead wants to review cancellations and returns together. The row has one known Status value. =OR(I2="Cancelled",I2="Returned") asks whether either label is present. Here only one status can be true at once because each record holds a single label. In other examples, OR also returns TRUE when both conditions are true.
Write the complete question for each option
In a formula the standalone text "Returned" does not mean “compare the same cell with Returned.” Write I2="Returned" as its own test. This keeps the reference and expected value together. A common review technique is to temporarily put both tests in neighbouring columns and check which one is true on a cancelled row and on a returned row.
In a support queue there can be separate flags for a missing address and a missing phone number. An OR of the flags sends a row to review when it has either problem. When both problems occur, it still sends one row to review. If the team needs the reason, keep the flags as separate columns rather than returning only the common tag.
Distinguish “any” from “exactly one”
Suppose an event signup sheet needs exactly one contact channel to be provided. An OR check only proves at least one field qualifies, so it also accepts two channels. One possible rule for two Boolean tests is =AND(OR(B2="Yes",C2="Yes"),NOT(AND(B2="Yes",C2="Yes"))). It requires at least one Yes and excludes two Yes values. For a work file, use a simpler input design with one approved channel if feasible.
Test four cases for a two-input rule: neither, first only, second only and both. The final case reveals an unintended assumption that OR accepts one true condition only. Write down the expected category for “both” before you build a selection or automate a decision.
Use NOT to reverse a well-scoped question
=NOT(I2="Delivered") reverses the result of “does this known status equal Delivered?” For a row with Cancelled it returns TRUE. For a Delivered row it returns FALSE. You could write =I2<>"Delivered" for this specific inequality. The choice is how best to express the policy for someone reviewing the sheet.
Check what belongs in the opposite group
A blank status and a misspelling can also fail the Delivered equality. Negating that equality includes them with the known statuses that are not delivered. The broad class is therefore different from “confirmed cancellations and returns.” If the report needs the narrower group, use explicit OR comparisons for those values. For a report needing all other confirmed statuses, verify the status is a known label before applying NOT.
Pending provides a helpful check. A Pending row is not Delivered yet, so the simple NOT expression gives TRUE. It is neither Cancelled nor Returned, so the explicit OR returns FALSE. A team using the same label for these results could misunderstand both the queue and its outcome counts. Write descriptive headings such as Not Delivered and Cancellation or Return.
Why does a blank status sometimes pass NOT of Delivered?
A blank does not equal the text Delivered, so the comparison is false and NOT reverses it. That does not establish why the order was not marked delivered. Add an input-quality check or explicitly list known qualifying statuses.
Map values with SWITCH and handle unknown results
Sometimes the job is to translate a code rather than combine independent conditions. In the practice course, an order ID beginning with BLK identifies the synthetic Blinkit dataset. AMN identifies the synthetic Amazon Now dataset. LEFT(A2,3) reads the first three characters of the ID in A2. SWITCH compares the extracted code with the alternatives and returns the result attached to the first match.
Read each match as a value-and-result pair
=SWITCH(LEFT(A2,3),"BLK","Blinkit","AMN","Amazon Now","Review code") has one expression, two value-result pairs and a final default. "BLK" is a value to be matched. "Blinkit" is its result. For a new code that has no pair, the last independent argument returns Review code. Without a matching value or a default, SWITCH returns #N/A.
For ordinary numeric ranges, compare the amount with a threshold using IF or IFS. A SWITCH call with amount as its expression and 500 as a listed match tests whether the amount equals 500. It does not express at least 500. You may see a pattern that switches on TRUE with comparisons as its cases, but IFS or nested IF will usually show those threshold choices more directly to a beginner.
Use a deliberate default and check the source
The first three characters can help classify a trusted order ID. They do not prove the whole ID has the expected format. For example BLK by itself still gives a matching prefix, while the order number after a dash is absent. Put input checks in a separate step if data can be incomplete. A label like Review code keeps a new or unknown code visible while the owner confirms its meaning.
Some Excel versions cannot calculate SWITCH. For a short two-code example, use nested IF with explicit equality. For a larger code list maintained by a team, use a lookup table with exact match and an explicit not-found action. This approach also lets somebody review the definitions without reading a long formula. Verify which option is available in the worksheet edition you will share.
Trace one row through three independent questions
Read the real row
The course row for AMN-1003 has Pune, fourteen minutes and Delivered. Read all three fields before assigning a label. The platform prefix does not change the timing threshold.
Test every requirement
For a fast Pune delivery, City and Status qualify. Fourteen minutes exceeds the ten-minute limit. AND returns FALSE because one required test failed.
Try the two-case review rule
Delivered equals neither Cancelled nor Returned. The support queue's OR condition is FALSE. This result answers a different question from whether the delivery was fast.
Map the prefix separately
LEFT extracts AMN. SWITCH returns Amazon Now under our fictional codes. The platform label does not tell us whether the order is fast or whether it needs review.
Lab 1 · Flag fast Pune deliveries and support-review cases
Goal. Use AND, OR and NOT on the same verified rows and compare their outcomes. Add a worksheet called Logic Orders to your own scratch workbook. In A1:G1 write Order ID, City, Minutes, Status, Fast Pune, Review Case and Not Delivered. Enter the six input examples in the table, with each duration typed as a number.
- Define fast Pune. In E2 enter
=AND(B2="Pune",C2<=10,D2="Delivered"). Fill down through row 7. Confirm that the valid 10-minute boundary meets the requirement. - Define support review. In F2 enter
=OR(D2="Cancelled",D2="Returned"). Fill to F7. The condition includes both known statuses without asserting that either outcome has the same operational cause. - Compare the wider class. In G2 enter
=NOT(D2="Delivered")and fill to G7. Check the Pending row. It qualifies for Not Delivered but fails the narrower Support Review condition. - Translate to an action. In an unused column write
=IF(E2,"Check as a fast delivery","Outside this report")and fill down. The sentence simply labels the Boolean decision. Keep the E column while learning so you can inspect the test outcome directly. - Make a boundary edit. In the scratch copy change the 10-minute test row to 10.01 minutes. E becomes FALSE, while its support-review result stays FALSE because you did not edit the status. Restore 10 after observing the change.
| Order | City | Minutes | Status | Fast Pune | Review Case | Not Delivered |
|---|---|---|---|---|---|---|
| BLK-1001 | Pune | 9 | Delivered | TRUE | FALSE | FALSE |
| AMN-1003 | Pune | 14 | Delivered | FALSE | FALSE | FALSE |
| BLK-1004 | Nagpur | 11 | Cancelled | FALSE | TRUE | TRUE |
| AMN-1008 | Sambhaji Nagar | 10 | Returned | FALSE | TRUE | TRUE |
| TEST-10 | Pune | 10 | Delivered | TRUE | FALSE | FALSE |
| TEST-P | Pune | 7 | Pending | FALSE | FALSE | TRUE |
Expected evidence. Fast Pune has two true rows, Review Case has two, and Not Delivered has three. Identify the records by order ID. If the counts match but the IDs differ, inspect the thresholds and labels. A good review verifies which records qualified rather than validating an aggregate alone.
Lab 2 · Map a prefix and city name to clear outputs
Goal. Match exact known categories, flag missing values explicitly and see how the fallback behaves. Add a blank worksheet called Code Review. Use A1:E1 for Order ID, City, Prefix, Platform and City Code. Enter the six example pairs in the table. Leave cells marked blank genuinely empty. Set each valid order ID as text, including its dash.
- Extract the source value. In C2 enter
=LEFT(A2,3)and copy down. Confirm BLK and AMN in the first two rows. When A is blank, the extracted prefix is empty. - Map the known platform prefixes. In D2 use the first formula below and fill down. It checks the original ID for an empty value before using the prefix mapping. A real ID with a new prefix asks for code review.
- Map the city by a different field. In E2 use the second formula and fill down. Pune becomes PUN and Nashik becomes NSK. For an unknown city the result is Review city. Add further approved pairs only after confirming their exact spelling and meaning.
- Cross-check the dependencies. In your scratch sheet change only Pune in B2 to Nashik. E2 should become NSK while D2 stays Blinkit. The platform output depends on the ID and prefix. The city output depends on B2. Restore Pune after checking.
- Test why an explicit default helps. In an unused cell evaluate a SWITCH formula without a default against the unfamiliar prefix XYZ. It returns
#N/A. Keep the review label in the actual lab output so a reader can tell how many codes need investigation.
D2 =IF(A2="","Missing ID",SWITCH(C2,"BLK","Blinkit","AMN","Amazon Now","Review code"))
E2 =IF(B2="","Missing city",SWITCH(B2,"Pune","PUN","Nashik","NSK","Nagpur","NGP","Kolhapur","KOP","Solapur","SLP","Sambhaji Nagar","SBN","Review city"))
| Order ID | City | Prefix | Platform output | City output |
|---|---|---|---|---|
| BLK-1001 | Pune | BLK | Blinkit | PUN |
| AMN-2101 | Nagpur | AMN | Amazon Now | NGP |
| BLK-1002 | Nashik | BLK | Blinkit | NSK |
| XYZ-1000 | Solapur | XYZ | Review code | SLP |
| Leave blank | Kolhapur | Blank | Missing ID | KOP |
| AMN-2000 | Unknown city | AMN | Amazon Now | Review city |
AMN-2101 is an extra order ID chosen for this separate mapping exercise. Changing its city code does not change the field used to derive its platform name. If your Excel cannot use SWITCH, reproduce D with nested IF over the two known prefixes and work through the expected city outputs by reading the pairs. Check the source labels and settings before assuming the fallback result is a typo.
Group combined rules so the policy stays clear
A team asks for “Pune or Nashik deliveries in ten minutes or less.” Read this as a city eligibility condition, a status condition and a time condition. Only the city alternatives use OR. Requiring the whole group means putting that OR result inside AND with Delivered and the valid timing cutoff. In the course-style layout with City in C, Minutes in H and Status in I, a clean-data test is =AND(OR(C2="Pune",C2="Nashik"),I2="Delivered",H2<=10).
Check which conditions apply to both alternatives
Placing OR around “is Pune” and “is a ten-minute completed Nashik order” would accept every Pune row, including long and incomplete ones. The intended policy first asks whether the city is allowed, then applies the same status and time tests to every allowed city. Test a slow Pune result and a fast Nagpur result to make sure neither passes by accident.
Use named helper checks when the formula gets long
For the first draft, create separate columns named Target City, Delivered and Within Ten Minutes. Fill them with explicit Booleans after you have checked the raw types and missing fields. In a final column combine their values with AND. When a reviewer asks why a row failed, you can point to a precise condition without unpacking every branch.
Once the checks are reliable, decide whether the helper columns should stay. They can be valuable audit evidence in a workbook serving a wider team. If you combine everything into one expression, keep a small decision table with known cases, including a row that passes only when all conditions are met and a separate row that fails each requirement.
Does a 9-minute Delivered order in Nagpur pass for Pune or Nashik?
No. Its status and time pass, but the inner OR produces FALSE because both city comparisons fail. The outer AND needs that city result to be TRUE too.
Separate input validation from the report's Boolean checks
An AND condition works on the values given. If the minutes field is blank, comparing it directly with 10 can let an empty measurement look small in a numeric context. A blank Duration and a measured 0 are different situations. The training lab supplied known measured numbers. A workbook that receives an export needs a path for unmeasured or invalid data before classifying delivery speed.
Confirm that comparison has a meaningful input
- Recognised status. Link the raw status to a known vocabulary. Report missing or unfamiliar values where somebody can review them.
- Measured time. Use a type check and a policy check for the allowed values. Confirm the exact unit and precision before comparing it with ten.
- Valid city. Check for blank or incorrectly spelled labels. Map data to approved values with a verified source when a label variant is expected.
- Compare business rules. Once those checks pass, apply the department's actual conditions. Unknown input and a true negative result should have distinct review outcomes.
Be careful about using a logical function to guard an expression that can produce an error. For example, =AND(B2<>0,A2/B2>1) should not be relied on to avoid a division by zero. Use an appropriate check or conditional calculation that handles the invalid denominator before computing a ratio, and verify that behaviour in the target workbook. A condition framework is easier to audit when input validation and numeric calculation have clear separate roles.
Decide what happens after a check
A TRUE value is evidence of a tested condition, never independent authority for a business action. In a practice support review, OR may flag a known cancellation or return. The team then checks what happened and chooses a response. Label the Boolean Needs Review if the next action is review. Avoid labels that imply a confirmed loss or refund when the calculation only saw a status category.
Reverse a whole rule and predict the resulting group
A practice pickup queue lets an order leave only if it is ready and has a confirmed payment. A second queue wants everything that still needs one of those requirements. For known Boolean inputs, the complete requirement is =AND(B2="Yes",C2="Yes"). A check for unresolved requirements is =NOT(AND(B2="Yes",C2="Yes")). This reverses the result of the whole combination.
Work through each pattern of missing requirements
Take a ready order that is not paid. The inner AND returns FALSE and the outer NOT returns TRUE, so it stays in the follow-up queue. Take an unpaid order that is also not ready. It stays in the same queue with two unmet requirements. A ready and paid order is the only way the original AND can succeed. In that case the check for unresolved requirements is FALSE.
You can express the same policy as “not ready or not paid.” For known clean Yes or No text, =OR(NOT(B2="Yes"),NOT(C2="Yes")) returns the same result. Compare the two expressions on all four Ready and Paid combinations. Using AND of the individual negations would instead only catch the case where both requirements failed.
| Ready | Paid | Can leave | At least one unresolved | Both unresolved |
|---|---|---|---|---|
| Yes | Yes | TRUE | FALSE | FALSE |
| Yes | No | FALSE | TRUE | FALSE |
| No | Yes | FALSE | TRUE | FALSE |
| No | No | FALSE | TRUE | TRUE |
Give the follow-up queue enough information
The Boolean identifies that some condition is not met. To route cases, include the two original named flags. A payment specialist can inspect unpaid rows while the store team inspects preparation. For a row with both issues, document who owns the shared follow-up and avoid double-counting the row as two orders. If an input is missing or produced by a broken formula, resolve its data-quality state before reporting a confirmed No.
Is NOT of AND the same as requiring both conditions to fail?
It returns TRUE whenever the requirements do not all succeed. One failed requirement is enough. To require that both fail, AND together the two individual negative tests.
Use a control table to expose the wrong grouping
Create two formula columns in a scratch worksheet. The first uses the intended rule: Pune or Nashik, and Delivered, and at most ten minutes. The second represents an incorrect grouping in which any Pune order qualifies or a Nashik order passes the other requirements. This comparison demonstrates how several conditions can all be present in a formula while the spreadsheet still does the wrong job.
Compare how the parentheses group alternatives
With City in A, Minutes in B and Status in C, the intended formula in D2 is =AND(OR(A2="Pune",A2="Nashik"),B2<=10,C2="Delivered"). In E2 enter the deliberately incorrect =OR(A2="Pune",AND(A2="Nashik",B2<=10,C2="Delivered")). Use them only for a controlled error demonstration. Fill both formulas across the six rows of the comparison table, then inspect where they diverge.
| City | Minutes | Status | Intended | Incorrect |
|---|---|---|---|---|
| Pune | 10 | Delivered | TRUE | TRUE |
| Nashik | 8 | Delivered | TRUE | TRUE |
| Pune | 14 | Delivered | FALSE | TRUE |
| Pune | 8 | Cancelled | FALSE | TRUE |
| Nashik | 11 | Delivered | FALSE | FALSE |
| Nagpur | 8 | Delivered | FALSE | FALSE |
The unintended grouping incorrectly accepts the slow Pune order and the cancelled Pune order. The Nashik examples behave as you expected in both expressions. This is why testing one city or one kind of exception may not expose the bug. A useful test set varies the inputs in each group, including good examples that should still pass after the repair.
Check the reason as well as pass or fail
Add helper checks for the city, duration and status in separate columns. If the goal is to explain a failure, use the helper labels to identify every unmet requirement. An IF of the first false condition can name one issue, but can hide a second one on the same row. Decide whether you need a single assigned action or a full account of the evidence. Save only the intended rule in the workbook people use.
Validate an identifier before applying its code map
Our platform label depends on the first three characters. A spreadsheet receiving a new order file should also ask whether the identifier looks complete under the source's contract. Suppose the training format uses a known three-letter prefix, a dash, and a nonempty suffix. A short word such as BLK has a recognised prefix but no separator or order number. Let the shape check catch it before the platform report treats it as a normal entry.
Test three pieces of the practice shape
For a known text input in A2 use =AND(LEN(A2)>4,MID(A2,4,1)="-",OR(LEFT(A2,3)="BLK",LEFT(A2,3)="AMN")). The length check requires at least one character beyond the prefix and dash. The MID comparison checks the exact separator position. The final group checks either approved prefix. This simple exercise checks those three parts only. A business rule may also constrain the suffix to digits or require the ID to be unique.
Check BLK-1001 and AMN-1003 first and expect TRUE for each. Then try BLK, BLKX1001, BLK-, and XYZ-1000. All four fail for different combinations of reasons. Keeping their literal strings in a small test table makes it easy to reproduce the outcomes if a later source changes its format. Before adding another prefix to the map, confirm how its records should be parsed and which platform label the source owner expects.
Compare a derived label with a separately supplied label
The course example has both Platform and an ID prefix. If you receive both fields from a trusted source, compare the derived label with the raw platform label for valid recognised codes. A disagreement prompts review rather than an automatic replacement. The ID could be mistyped, the platform field could be stale, or the mapping could have changed. Record which input best captures the business fact and use a known row to verify the update.
When several people maintain a longer code map, give the table a clear change owner. A new pair should come with one verified matching example and one old example that still works. Avoid putting the same match value twice in a SWITCH expression. The first matching pair wins, so a later conflicting result can become unreachable.
Reconcile both report queues against the full sample
Move from the six practice rows to the ten-row Orders table on the chapter overview. The columns there are Order ID in A, City in C, Platform in D, Category in E, Amount in G, Minutes in H and Status in I. Work from a scratch copy or re-enter the rows. Use those original column addresses rather than copying the four-column lab formula unchanged.
Check which IDs each set selected
Apply the three-part fast Pune condition to the full table. The matching IDs are BLK-1001 at nine minutes and BLK-1006 at eight minutes. A Pune completion AMN-1003 is slower at fourteen minutes and must fail. Also check a Pune cancellation, BLK-1009. Its presence in the same city must not give it the fast-delivery label.
Separately apply the cancellation-or-return review rule. Expected IDs are BLK-1004, AMN-1008 and BLK-1009. In this table the broad NOT Delivered result has the same three IDs because the rows use only Delivered, Cancelled and Returned. The lab introduced a Pending control to prove why these definitions can diverge in a later file. Keep that test even though the first report happens to have equal counts.
Choose a denominator that answers the stakeholder's question
Two of the ten sample orders are fast Pune deliveries. That is 20% of all sample order records. If the question is “what share of Pune deliveries took at most ten minutes?” use the three completed Pune deliveries as the denominator. Two out of three, or about 66.7%, describes that different population. Identify the numerator's conditions and the denominator's conditions before presenting either result.
Make a small handover for each report with the selected IDs and the criteria. If a later workbook has no completed Pune deliveries, the second percentage lacks a usable denominator. Mark the measure as unavailable and state that no rows qualified for its base. A dashboard can show a count of zero while leaving the corresponding percentage unavailable. This lets readers distinguish a missing population from measured zero performance.
- Check the starting table. Confirm that the source contains the expected ten unique order IDs for this sample.
- Check each queue. Compare the individual matches and the total, including a case that should fail each requirement.
- Check the purpose. Write the reason for including or excluding Pending before adding a future sample row.
- Check the review boundary. In a scratch copy set the status of a cancelled review case to a documented Pending value. The support review count falls by one, and the broader Not Delivered count remains unchanged. Restore the status and verify the original count.
Apply the checks to a new report
- Filter the sample purchase range. On valid course rows test Platform equals Blinkit, Category equals Fruits and Amount exceeds 200, all with AND. Check. BLK-1002 and BLK-1004 both qualify in the ten-row sample. Add Delivered if the report should exclude the cancelled BLK-1004.
- Compare two definitions. Enter Pending in a new known status row and calculate both the simple negation of Delivered and the OR of Cancelled and Returned. Check. The broad check gives TRUE and the review-case OR gives FALSE.
- Handle an unknown city safely. In the code lab replace the city name with a confirmed unknown value. Check. The city output asks for review while the platform output remains derived from the prefix. Restore the original city after checking.
Check your understanding
1. Ready is true and Paid is false. What does AND return?
- A. TRUE
- B. FALSE
- C. The string Paid
Answer B. AND needs every input test to be true. The payment test fails. An OR would return TRUE here because the ready test succeeds.
2. What happens when both input conditions to OR are true?
- A. OR returns TRUE
- B. OR returns FALSE because there are two matches
- C. OR returns two different rows
Answer A. OR tests whether at least one condition is true. Both true still satisfies that definition. An exactly-one policy needs an extra test.
3. Pending is a valid status. Which checks return TRUE for it?
- A. OR of Cancelled and Returned only
- B. Both the OR and the simple negation of Delivered
- C. Only the simple negation of Delivered
Answer C. Pending differs from Delivered, so the negated equality is true. It matches neither of the two explicit support-review labels.
4. A valid order ID starts with XYZ and the mapping has no XYZ pair. What should the lab return?
- A. Amazon Now
- B. Review code
- C. Missing ID
Answer B. The identifier is present but contains an unrecognised prefix. The fallback is Review code. The pre-check uses Missing ID only when the ID has an empty value.
5. Which combination means Pune or Nashik, plus a required Delivered status?
- A. AND of the city OR group and Delivered
- B. OR of the city OR group and Delivered
- C. AND of Pune, Nashik and Delivered separately
Answer A. The city needs either accepted value. Both the city group and the delivery status are required. OR between those requirements would allow a qualifying city without completion.
6. Should SWITCH with expression 600 and a match value 500 treat 600 as at least 500?
- A. Yes, provided it is the first match option
- B. Yes, because both values are numerical
- C. No. A 500 match checks equality in that pattern
Answer C. A SWITCH case compares the single expression with that case's specified value. For a minimum threshold, write an explicit comparison with IF or IFS.
Interview questions with worked answers
- How do you decide whether a report uses AND or OR?
I identify which facts are requirements and which are alternatives. A ten-minute Pune delivery must satisfy the city, timing and completion checks together, so I use AND. A queue that accepts confirmed cancellations or confirmed returns uses OR between the two status tests. I check one row that fails each requirement.
- Why can a NOT check include more rows than a cancellation or return flag?
Negating the Delivered comparison catches anything it considers different from Delivered. That can include valid Pending entries, missing statuses or unknown words. A cancellation or return flag tests two exact values and gives a narrower class. I verify valid input and name each result according to its scope.
- When do you choose SWITCH over nested IF?
I choose SWITCH when one expression needs to match one of several explicit values, such as a known city code. I provide a default review result for unknown mappings. For ranges or conditions involving multiple different fields, I use explicit logical tests with IF or IFS. I check that the receiving Excel edition supports the chosen function.
- How do you test a combined filter with grouped conditions?
I use cases that independently vary a city, timing and status. I include a fast wrong-city row and a slow right-city row so each requirement is tested. I then compare the passing record IDs, including boundary rows, with an independently constructed list of expected records.
- What makes an unknown-value default helpful?
It provides an obvious path for a newly introduced code instead of letting it silently appear as a known category. I count those default results and check the source mapping. Once approved, I update the code list and repeat a test with both a recognised and unrecognised value.
Quick recall cards
- AND
Every explicit condition must be true. Test a row where one requirement fails.
- OR
One or more conditions can be true. Both true qualifies.
- NOT
Flips a Boolean result. Review what the opposite group actually includes.
- Logical groups
Put alternative values inside an OR group. Combine that result with common requirements using AND.
- SWITCH
Matches one expression to explicit values. Keep an intentional default for unmatched values.
- Validate input
Type, missing states and recognised values are checked separately from the final report logic.
Next you will work with missing lookup results and formula errors. Keep a deliberate unmatched-code label separate from an unexpected error in a source formula. They tell your team to take different actions.
Official Microsoft references
Continue practising: explore the existing Excel Task Hub for additional exercises.