How to return another cell if one cell equals text or another in Excel?
For example, I have the following data range, now, I want to extract the values in column C if the corresponding data in column A equals adjacent data in column B as below screenshot shown. How could I deal with this task in Excel?
Here is a simple formula can help you to return the value in another cell if one cell equals the adjacent one, please do as this:
Enter this formula: =IF(A2=B2, C2, "") (A2 and B2 are the two cells that you want to compare, and C2 is the cell value that you want to return) into a blank cell where you want to display the result, and then drag the fill handle down to the cells that you want to return the corresponding values, see screenshot:
Here is another situation, let’s say, you have two columns, and you need to return the cell value based on another cell if it contains a specific text, such as “Yes” as following screenshot shown:
To deal with this task, you should apply this formula: =IF(B2="yes",A2,"") into a blank cell to output the result, and then drag the fill handle down to the cells that you want to contain this formula, and all the values adjacent your specific text have been returned as following screenshot shown:
If you have Kutools for Excel, with its Select Specific Cells feature, you can quickly select the rows with the specific text value, and then paste the rows into another place as you need.
|Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.|
After installing Kutools for Excel, please do as follows:
1. Select the column which contians the specific text you need, and then click Kutools > Select > Select Specific Cells, see screenshot:
2. In the Select Specific Cells dialog box, select Entire row from the Selection type, then choose Equals under the Specific type sectionand and enter the specified text "Yes" into the text box, , see screenshot:
3. Then click Ok button, all rows which contain the specific text have been selected, and then copy and paste the selected rows into another cells as you need, you will get the follwoing result as you want.