Home » excel » vba – Returning a value based on multiple conditions in excel

vba – Returning a value based on multiple conditions in excel

Posted by: admin May 14, 2020 Leave a comment


Consider the following data:

 Item | Overall | Individual | newColumn
 A    | Fail    | Pass       | blank
 A    | Fail    | Fail       | blank
 B    | Fail    | Pass       | issue
 B    | Fail    | Pass       | issue
 C    | Pass    | Pass       | blank

I have the logic built out for the first 3 columns already. There are two levels of fails in this data:

  1. overall, and
  2. individual.

If any of the individual fail, the overall fails. Sometimes the overall can fail even though all the individuals are fine. This logic is already built out.

I am trying to find a formula for the newColumn. If all the individuals are a pass for a given item (example item B), but the overall is still a fail, the cell should return the text “issue”. It is ok if it returns issue twice, not sure if you can non-dupe that part. I’ve tried various forms of countifs/and/ors and creating columns that count distinct values but I always find a scenario where it will break the logic.

How to&Answers:

Try this:


As required

enter image description here


If you add a new column with the formula:


Then this should work on the assumptions:

  • For each item if one of the overalls are false they are all false
  • The only two possible values are “Pass” and “Fail” for columns B & C

If you require the word blank instead of a blank cell then use: