
Set WorkRng1 = Application.InputBox("Range A:", xTitleId, "", Type:=8) VBA: Compare two ranges in two spreadsheets Sub CompareRanges()ĭim WorkRng1 As Range, WorkRng2 As Range, Rng1 As Range, Rng2 As Range Click Insert > Module, and copy the VBA into the module. Hold ALT button and press F11 on the keyboard to open a Microsoft Visual Basic for Application window.Ģ. If you want to find the unique values in Sheet1, but not in Sheet3, you need to enter the above formula = COUNTIF(Sheet3!$A:$A, A1) into Sheet1.Ĭompare two ranges in two spread sheets with VBAġ. (Number Zero means duplicate values in two ranges, and Number 1 means unique values in Sheet3, but not in Sheet1)ġ.This formula only can compare two columns with the same header in two spreadsheets.Ģ. Press Enter button on the keyboard, and then drag the fill handle to fill the range you want to compare with the range in Sheet 1. Typing this formula =COUNTIF(Sheet1!$A:$A, A1) in a blank cell which is adjacent to the range in Sheet 3. With the formula in Excel, you can compare two same header columns as shown as below on different sheets and find the duplicate and unique values:ġ.

Excel find duplicates macro pdf#
Split Tools: Split Data into Multiple Sheets Based on Value One Workbook to Multiple Excel, PDF or CSV Files One Column to Multiple Columns.

Merge Tools: Multiple Workbooks and Sheets into One Merge Multiple Cells/Rows/Columns Without Losing Data Merge Duplicate Rows and Sum.More than 20 text features: Extract Number from Text String Extract or Remove Part of Texts Convert Numbers and Currencies to English Words.Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by
