+ Reply to Thread
Results 1 to 3 of 3

Comparing Multiple Columns In 1 Sheet to Columns in Another

  1. #1
    Registered User
    Join Date
    03-14-2018
    Location
    Boston, United States
    MS-Off Ver
    2013
    Posts
    2

    Comparing Multiple Columns In 1 Sheet to Columns in Another

    Hello,

    I am trying to compare columns B through J in in two excel spreadsheets (they are in the same workbook).

    I want column K from the first sheet to display true if every column on the first spreadsheet contains the same numerical value as to every column on the second spreadsheet.

    This is my code:
    Please Login or Register  to view this content.


    I call the function with =EQUALVALUES(B2:J2, Sheet2!B2:J2)

    I get a #NAME? error when I call the function.

    Is there something wrong with the function or can it just not see the function for some reason?
    Attached Images Attached Images
    Last edited by anonymous12; 03-14-2018 at 10:44 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Comparing Multiple Columns In 1 Sheet to Columns in Another

    Welcome to the Forum anonymous12!

    If you are getting a NAME error then you probably do not have the function declared in the correct place. You should have it declared as public in a generic module (like Module1) and not in a worksheet module (like Sheet1).

    Second, I see another problem in your Function declaration. ParamArray is not a way to declare that an argument is an array. It is a way to show that a function can be called with a series of any number of arguments that can be treated as an array. A example of this is the SUM function. But that is not what you have. You have two arguments that are arrays. They should be declared without ParamArray.

    But. You are passing in Ranges, not arrays. So your function should work with Ranges.

    Your code should look like this, which I have tested. This will return a #COUNT! error if the two ranges do not have an equal number of cells.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    03-14-2018
    Location
    Boston, United States
    MS-Off Ver
    2013
    Posts
    2

    Re: Comparing Multiple Columns In 1 Sheet to Columns in Another

    That worked, thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Code to compare/match multiple columns in one sheet with multiple columns in another
    By cellsearch123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2016, 09:25 AM
  2. Comparing a cell in sheet 1 to columns in multiple sheets
    By chrisdua12 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-13-2016, 04:46 PM
  3. Comparing Multiple Columns on 2 sheets and report Exceptions on 3rd Sheet
    By KrystalQ in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2014, 11:41 AM
  4. Replies: 0
    Last Post: 05-20-2013, 11:17 PM
  5. Replies: 2
    Last Post: 03-15-2013, 05:25 PM
  6. Macro to copy 3 columns of data from multiple sheets into 3 columns on 1 sheet
    By bballdcm2007 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-15-2012, 04:37 PM
  7. comparing multiple columns
    By teejay in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-02-2006, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1