# IF value in column matches another column, then insert text

#### Rick187

##### New Member
Hi,

Is there a formula that will insert specific text in a cell if any of the cells from column A are equal to the names in Column B?

For example

Column A contains

123
456
789

Column B contains:

471
871
951
123
456

the last 2 cells in column B (123, and 456) are also in Column A somewhere.

Column C next to the cell from Column B that says 123 will display "matching", and against 456 will also display "matching" but the rest of the cells in column C won't display anything.

Is this possible to do with a formula please?

Any help would be appreciated.

Thanks

### Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
 Cell Formula C2 =IFERROR(IF(MATCH(B2,\$A\$2:\$A\$20,0)>0, "matching",""),"")

<tbody>
</tbody>

Copy the formula down.

Hi,

You can use COUNTIF.

Change/adjust cell references/range as needed, formula copied down.

Book1
ABC
1123471
2456871
3789951
4123matching
5456matching
Sheet542
Cell Formulas
RangeFormula
C1=IF(COUNTIF(A\$1:A\$3,B1),"matching","")

Replies
10
Views
264
Replies
2
Views
124
Replies
5
Views
145
Replies
4
Views
83
Replies
9
Views
197

### Forum statistics

1,196,457
Messages
6,015,366
Members
441,889
Latest member
balolaptopgiaolong

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back