+ Reply to Thread
Results 1 to 4 of 4

Excel formula to compare two columns in workbook A to two columns in workbook B?

  1. #1
    Registered User
    Join Date
    11-16-2019
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    2

    Excel formula to compare two columns in workbook A to two columns in workbook B?

    Hello,

    My question is as follows:

    I am trying to compare column A and column B in a workbook called, "Euro Loan Pipeline - WEB CD" to column A and column B to another workbook called "Euro HY Pipeline - WEB CD".

    In both workbooks, column A is company name and column B is a specific date.

    The number of rows is not the same.

    What I would like this formula to do is, IF (there is a company with the same company name and date in the Euro Loan Pipeline workbook and also Euro HY Pipeline workbook) then paste the word match in the column adjacent to column B.

    For which i believe i have the formula:

    Please Login or Register  to view this content.
    where C3 = A3&B3

    This matter is further complicated by the fact that whilst a company is in the workbook Euro HY Pipeline and Euro Loan Pipeline, the date between the two workbooks may differ by +/- 7 days. As such i would like a 7 day tolerance to the date. Such that IF (there is a company with the same company name and date +/- 7 days in the Euro Loan Pipeline workbook and also Euro HY Pipeline workbook) then paste the word match in the column adjacent to column B.

    Is this possible? Any help would be greatly appreciated? Perhaps i need to use index match? or a dynamic array?
    Attached Files Attached Files
    Last edited by lordnoob; 11-17-2019 at 05:25 AM.

  2. #2
    Valued Forum Contributor Sadath31's Avatar
    Join Date
    03-02-2011
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Office 365
    Posts
    452

    Re: Excel formula to compare two columns in workbook A to two columns in workbook B?

    Hi

    this formula doen't require the column C where A3&B3

    HTML Code: 

  3. #3
    Registered User
    Join Date
    11-16-2019
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Excel formula to compare two columns in workbook A to two columns in workbook B?

    Hello,

    Thank you very much Sadath31! The formula works perfectly. Could I be as ignorant to ask for an explanation of the formula, for my own understanding what does the "--" do? also why the use of sumproduct?

    Thank you.

  4. #4
    Valued Forum Contributor Sadath31's Avatar
    Join Date
    03-02-2011
    Location
    Dammam, Saudi Arabia
    MS-Off Ver
    Office 365
    Posts
    452

    Re: Excel formula to compare two columns in workbook A to two columns in workbook B?

    Hi

    Glad to help you..

    the double hyphen is converting a list of boolean (true, false) values into ZEROs and ONEs.

    the first statement --(A2='[Euro HY Pipeline - WEB CD.xlsx]2019 Pipeline'!$A$3:$A$140) return a array of values consist of 0 and 1
    ie if A2='[Euro HY Pipeline - WEB CD.xlsx]2019 Pipeline'!$A$1 is true then return 1
    ie if A2='[Euro HY Pipeline - WEB CD.xlsx]2019 Pipeline'!$A$2 is false then return 0 .... so on

    the second statement
    B2-'[Euro HY Pipeline - WEB CD.xlsx]2019 Pipeline'!$B$3:$B$140 this returns array of values which is difference of dates

    ABS(B2-'[Euro HY Pipeline - WEB CD.xlsx]2019 Pipeline'!$B$3:$B$140) converts -ve value into +ve

    --ABS(B2-'[Euro HY Pipeline - WEB CD.xlsx]2019 Pipeline'!$B$3:$B$140)<=7 check the values is <=7 then return 1 (for true) or 0 (for false)

    Finally SUMPRODUCT multiplies both array and add together and return a number which is number of records matching the given criteria

    if the result is 0 that means no matching record, if the result is >0 then there is matching record.

    Hope this help 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. [SOLVED] VBA to compare first columns of 2 workbook sheets as selected from inputbox
    By Zimbo in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-03-2019, 07:21 AM
  2. [SOLVED] Loop through workbook and compare the columns
    By HXIO in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-31-2018, 09:47 AM
  3. [SOLVED] Compare and copy two columns from each sheet in a workbook
    By sarajun_88 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-01-2018, 08:25 AM
  4. Copy columns from closed workbook to different columns in open workbook
    By jGLZa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2012, 11:03 PM
  5. Replies: 1
    Last Post: 06-23-2011, 04:22 PM
  6. Compare two columns in one woorkbook, bounce results off of a different workbook.
    By goldenr1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2010, 12:19 AM
  7. Compare columns in 2 sheets in the same workbook and copy HELP NEEDED
    By ktab in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-22-2005, 08:23 AM

Tags for this Thread

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