Match formula

kumar1803

Board Regular
Joined
Jan 7, 2015
Messages
110
Hello,

I have two column where I need to perform a match function or formula.
If the first 4 or more characters in both "A" and "B" column matches, I want to see the results in the third column.

For Example:

Column A
[TABLE="width: 350"]
<tbody>[TR]
[TD]MONTEFIORE MEDICAL CENTER-MARGARET KEALY[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]


Column B

[TABLE="width: 346"]
<tbody>[TR]
[TD]MONTEFIORE MEDICAL CENTER[/TD]
[/TR]
</tbody><colgroup><col></colgroup>[/TABLE]


If the first 4 or more characters matches in both column, I like to see the results
 
You can use de LEFT() function to extract the first 4 characters of each cell and then compare them. The complete formula for Column C would be:
=IF((LEFT($A2,4)=LEFT($B2,4)),LEFT($A2,4),"")​
You do not need columns D through H, but they might help you understand the formula piece by piece.
If you need your formula to be case sensitive, use the EXACT() function.

I hope it helps.

ABCDEFGH
Column AColumn BColumn CLeftALeftBIsMatchCaseSensitiveResult
MONTEFIORE MEDICAL CENTER-MARGARET KEALYMONTEFIORE MEDICAL CENTERMONTMONTMONTMONT
HelloHiHellHi

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]VERDADERO[/TD]
[TD="align: right"]VERDADERO[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]FALSO[/TD]
[TD="align: right"]FALSO[/TD]

</tbody>


[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]C2[/TH]
[TD]=IF((LEFT($A2,4)=LEFT($B2,4)),LEFT($A2,4),"")[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]D2[/TH]
[TD]=LEFT($A2,4)[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]E2[/TH]
[TD]=LEFT($B2,4)[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]F2[/TH]
[TD]=$D2=$E2[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]G2[/TH]
[TD]=EXACT($D2,$E2)[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]H2[/TH]
[TD]=IF(F2,D2,"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top