Consulting

Results 1 to 9 of 9

Thread: Solved: Matching Multiple Cells

  1. #1

    Solved: Matching Multiple Cells

    Hi. this is my first post here, I really need help :-). I've been playing around with solutions to this problem for a while now and have decided to come to a forum to perhaps open my eyes. I've tried formulas (index, Match and the lookup functions) but don't seem to be getting anywhere. Not sure because I'm trying to match both text and numbers?
    I'll explain the objective and see what you guys think

    The DATA sheet is downloaded from our broker daily and has all the transactions for the day. What I am trying to do is match the data "automatically" with the clients. Up until now I have done it manually line by line, but sometimes over 200 transactions can drive one batty

    The match sheet is where the client details are entered. What needs to happen is that the cells O & P (unit number and unit price) need to be "pulled/matched" from the DATA sheet. There are 4 possible criteria to match with:

    The account # (col A ) on the match sheet with Client No. (Col F) on the DATA sheet
    BUY or Sell (Col E) on the match sheet with BUY/SELL (Col J) on the DATA sheet
    ASX Code (col G) on the match sheet with STOCK (col K) on the DATA sheet
    Client # (Col C) on the match Sheet with ORDER TAG (Col AB) on the DATA sheet


    So if all match (all 4 have to match as there may be many buys/sells of the same stock)

    QTY (Col L) from data sheet should be placed/filled in Unit Number (Col O) of the match sheet.
    and
    AVG PRICE (col M) from the data sheet should be placed/filled in Unit Price (Col P) of the match sheet.

    I hope that makes some sense. I have attached a sample spreadsheet to try and give you a better understanding of what I am looking for.

    Does anyone have a solution?

  2. #2
    Hi and welcome to VBAX

    This problem is easily solved by introducing two helper columns. They are colored light green in the attached sample. See the formulas: in them, the 4 important values are concatenated. So for each row you get a single string, which contains all 4 values that need to be compared, and you can base VLookUp fuunction on this string.

    HTH

    Jimmy
    Last edited by JimmyTheHand; 07-22-2008 at 03:17 AM.
    -------------------------------------------------
    The more details you give, the easier it is to understand your question. Don't save the effort, tell us twice rather than not at all. The amount of info you give strongly influences the quality of answer, and also how fast you get it.

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You can also do it with an array formula

    =IF(NOT(ISNA(MATCH(1,(DATA!$F$2:$F$20=match!$A2)*(DATA!$J$2:$J$20=match!$E2 )*(DATA!$K$2:$K$20=match!$G2)*(DATA!$AB$2:$AB$20=match!$C2),0))),
    INDEX(DATA!L$2:L$20,MATCH(1,(DATA!$F$2:$F$20=match!$A2)*(DATA!$J$2:$J$20=ma tch!$E2)*(DATA!$K$2:$K$20=match!$G2)*(DATA!$AB$2:$AB$20=match!$C2),0)),"")
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    Hi JimmytheHand & XLD, Thank you both, that's very cool.
    There is something that I neglected to mention. When I match the trades manually, I highlight each one by row(on the DATA) sheet, that way when i'm done I can see the unhighlighted trades must either be from another day or there is a another kind error.
    Is there a way to incorporate that into the formula/s?

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Use the formula in conditional formatting.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    Thanks :-)

  7. #7
    Hi XLD,
    Excel doesn't let me reference other work sheet with conditional formatting, it flashes an error. Using the same scenario as the original question. I have multiple "match sheets" and only one "DATA" sheet, the rows on the DATA sheet need to be highlighted when they are matched in the match sheets. Any ideas?

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You have to name the range(s) i the other worksheet and use that name in CF.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    Thanks again.

Posting Permissions

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