+ Reply to Thread
Results 1 to 7 of 7

How to compare a combination of 3 fields in 2 sheets

  1. #1
    Registered User
    Join Date
    04-24-2013
    Location
    Puerto Rico
    MS-Off Ver
    Excel 2007
    Posts
    3

    How to compare a combination of 3 fields in 2 sheets

    I have two sheets. In each sheet there are 4 columns. The unique combination of the first 3 columns has a value which is presented in column #4. For example the first 3 columns are account, cost center , product and the fourth column is $100. the second sheet has the same format. Is there a way to present in a single sheet all the columns of the 2 sheets in a row? For example account, cost center, product, $100 (these 4 from sheet 1) account, cost center, product $175 (these last four from sheet 2).All in one row to compare the fileds and amount.

  2. #2
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: How to compare a combination of 3 fields in 2 sheets

    Hello,

    The short answer is, yes you can, by using VLOOKUP if all datas are unique or you combine them together to make them unique, or by using INDEX with combination of SMALL to deal with duplicated datas.
    If you can provide a sample file, it will be easier for others to help you too.
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  3. #3
    Registered User
    Join Date
    04-24-2013
    Location
    Puerto Rico
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How to compare a combination of 3 fields in 2 sheets

    Thanks Lem.

    The values in a field are not unique, but the combination of the 3 should be. What do you mean by combine them together? what function should I use?

  4. #4
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: How to compare a combination of 3 fields in 2 sheets

    What I mean is like this,

    Assuming you are looking for account name "Vesca", cost center "CA", product "Excel", and the forth column is "$100".

    Now if you look them up individually, there might be 5 Vesca, 4 CA, 10 Excel and a hundreds (maybe) of $100. But the number of "Vesca at CA with product Excel and ... has $100", there's only a handful (1, in worst case, more than 1 ...).

    So instead of MATCH(A5, C5:C15) for example (match value in A5 in C5 to C15), you can make it MATCH(A5&B5,C5:C15&D5:D15) (match value combined by A5 and B5, in a "new" column by combining C5 to C15 with D5 and D15).

    For the function you should use, here are the lists of them that might be helpful - VLOOKUP, INDEX, MATCH, (In case there are duplicated, you might have to use SMALL, ROW)

    If you can provide a sample file, it will be much easier to illustrate it. It doesn't have to be exact data you have in your real file, can be anything but similar in layout and relevant in structure, and don't have to be large, only a handful of rows and columns will do.

  5. #5
    Registered User
    Join Date
    04-24-2013
    Location
    Puerto Rico
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How to compare a combination of 3 fields in 2 sheets

    Please see included sample file.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: How to compare a combination of 3 fields in 2 sheets

    This is the Array formula that I used
    Please Login or Register  to view this content.
    Because it is an Array formula, you will have to hold Ctrl-Shift and hit Enter to enter the formula (If it's wrapped inside a { }, then you did it right).
    Here is the sample file with formula.

    Note that the product column is text right? So I went ahead and convert the column in worksheet 2 to text.

    Same thing with the Cost Center column in both worksheets.

    But in any case you wanted them to be number, or if in your file one of them is number, then let me know because currently this formula works under the assumption that in both worksheet, Product and Cost Center column will contain text, not number).
    Attached Files Attached Files
    Last edited by Lemice; 04-24-2013 at 04:04 PM.

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to compare a combination of 3 fields in 2 sheets

    How comfortable are you with a code? It can be done with a macro(code) but only as the last resort.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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