If cell is this OR that

The IF function in combination with OR in excel can be used to do a specific thing when a cell equals this or that. In this case, the function will do one action is the result is TRUE and do something else if it is FALSE.

General formula

=IF(OR(A1=”this”,A1=“that”),“x”,“”)

How it works

To understand how the if the cell is this or that process works, we need to look at an example.

Example

Figure 1. Data example of student, staff and teacher’s revenue

In the above example, we want to mark with an X those records that are either for Teacher or Student. Put simply, we shall check the records in column A, and if they belong to either Teacher or Student, take appropriate action.

To get this, proceed as follows

Mark column C where we shall have the mark.

Then, in cells C2, input the formula as shown below:

=IF(OR(A2=“Teacher”,A2=“Student”),“X”)

Figure 2: Marking if the cell is this OR that

After we have specified the formula in cell C2, we then press Enter. This will mark it as X. we then copy the formula across all the other cells down, and we get X if the cell meets the criteria and FALSE if it does not meet the criteria. Look at the figure below:

Figure 3. The result of IF and OR functions

Points to note

  • In our example above, the logical test is.OR(A2=“Teacher”,A2=“Student”) It is this part that returns X or False according to whether or not the cell meets our set criteria.
  • If instead of having FALSE if the criteria are met you want to leave the cell empty, then you will add “” at the end of the logic.  The empty string will help the cell to remain empty, but without it, then the FALSE string will be displayed as it has happened in our case.
Our customers love us!
“The expert was absolutely amazing and stuck with me the whole way through. They were polite, patient, seemed to want to genuinely help me and provided a solution that I would never have managed otherwise. I could not be more thankful for their support and solution. Thank you!” - - Chris T, in California

Leave a Comment

avatar