Those functions are volatile though, so they’d slow down the workbook if you use too many of them.
Here are a few more articles that show examples of how to compare two cells – either the full content, or partial content. That page also has details on how the Percent Matched formulas work, and there’s a shorter version of the Percent Matched formula, if you’re using Excel 365. The sample workbook is in xlsx format, and does not contain any macros.
You download an Excel workbook with all the examples, and see more ways to compare two cells on my Contextures site. Thanks, UniMord, for sharing your formula to compare two cells, character by character. There is a 100% match in row 2, and only a 20% match, starting from the left, in row 5. The final step is to find the percent matched, by dividing the two numbers: Two minus signs, near the start of the formula, converts TRUE and FALSE to ones and zeros.Left X characters from the two cells are compared, using equal sign.INDIRECT and ROW functions create an array of numbers, from 1 to X.Here’s a quick overview of how the formula works, and there are detailed notes on the Compare Two Cells page of my Contextures site See the new formula on the Compare Two Cells page of my Contextures site. Tip: If you’re using Excel 365, there’s a shorter formula you can use, with one of the new Spill functions. Next, the formula in column D finds how many characters, starting from the left in each cell, are a match. The first step in calculating the percent that the cells match is to find the length of the address in column A. Here’s a sample list, where three formulas check the addresses in column A and B, and calculate the percent that the characters match. What percent of the string in A2, starting from the left, is matched in cell B2? For example, check the last 3 characters, and combine with the EXACT function:įinally, here’s a formula from UniMord, who needed to know how much of a match there is between two cells. To compare characters at the end of the cells, use the RIGHT function. For example, check the first 3 characters: To compare characters at the beginning of the cells, use the LEFT function.
Sometimes you don’t need a full comparison of two cells – you just need to check the first few characters, or a 3-digit code at the end of a string. See more EXACT function examples on my Contextures site. The EXACT function doesn’t test the formatting though, so it won’t detect if one cell has some or all of the characters in bold, and the other cell doesn’t. This video shows a few EXACT examples.Īs its name indicate, the EXACT function can check for an exact match between text strings, including upper and lower case. If you need to compare two cells for contents and upper/lower case, use the EXACT function. (Upper and lower case versions of the same letter are treated as equal). If the cell contents are the same, the result is TRUE. The quickest way to compare two cells is with a formula that uses the equal sign. Get an Excel workbook with all the examples from that page too.
Aside from staring at them closely, how can you compare two cells in Excel? Here are a few functions and formulas that check the contents of two cells, to see if they are the same.