Set Range2 = Application.InputBox("Select the second range in another column:", "FindUplicatesinTwoColumns", Type:=8)ĥ# back to the current worksheet, then run the above excel macro.Ħ# Select the first range A1:A4 in Column A, click OK button, then select the second range B1:B4 in Column B, click OK button. Set Range1 = Application.InputBox("Select the first range in one column:", "FindUplicatesinTwoColumns", Range1.Address, Type:=8)
#Excel find duplicates in multiple columns code
If you are familiar with the programming language and you can use a Visual Basic Macro to compare the value in two columns and then find duplicate values, just refer to the following steps:ġ# click on “ Visual Basic” command under DEVELOPER Tab.Ģ# then the “ Visual Basic Editor” window will appear.ģ# click “ Insert” ->” Module” to create a new moduleĤ# paste the below VBA code into the code window. Method 2: Find duplicate values in two columns with VBA Macro code Now you need to type this formula in Cell C1, press Enter key, drag AutoFill Handle down to Cell C2:C4, you will see all of the duplicated values are displayed in Column C. So you can use the following formula: = IF( ISERROR( MATCH(A1,$B$1:$B$4,0))," ",A1)
To compare two given columns and find duplicate values in Excel, you can use a combination of the IF function, the ISERROR function, and the MATCH function to create an Excel formula. Method 1: Find duplicate values in two columns with Excel Formula