Finding duplicate values in 2 columns using VLOOKUP works exactly the same in Google sheets as it does in Excel.
Find Duplicate Values VLOOKUP Function in Google Sheets. Remember to save your file in either XLSM or XLAM format to save your VBA code. This will give us the exact same result as using the VLOOKUP to return the duplicate value. Furthermore, the subroutines in modules can be used by icons in the menu ribbons or keyboard shortcuts. The main advantage of the module method is that it allows saving the code in the file, so that it can be used again later. Copy and paste the code into the module to run it. Below are some index numbers for colors:įirst, you need to add the module into the workbook or the add-in file to be able to use the code. With statement allows us to not use bothcolumns every time, and the For…Next loop is how we can check for every cell.Īfter you get the range, you can use the ColorIndex property to set that range a color. Selected range is assigned to a range variable bothcolumns, and each cell in that range is compared row by row. The code requires the user to select columns in a single range.
#HOW TO USE VLOOKUP IN EXCEL FOR COMPARING TWO COLUMNS HOW TO#
Let us show you how to compare two columns in Excel using VBA and automate this process. Comparing columns of data manually is not a realistic approach when working with large data sets.