+ Reply to Thread
Results 1 to 20 of 20

Finding matching cells then returning data of another cell

  1. #1
    Registered User
    Join Date
    10-01-2012
    Location
    North Bay, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    60

    Finding matching cells then returning data of another cell

    Hey guys,

    Here's my dilema this morning... I have roughly 10 000 data lines and I need to perform a search that will match columns A and B to identical cells in A and B and then return the datas from C beside each of these identical A and B's in another cell (Cell D)

    Example:

    Cell A: 654
    Cell B: 3
    Cell C: 123

    I want to find another row in which cells A and B are (654 and 3 respectively) and then take the value of cell C and combine it with cell C above (123)

    Any help?

    Pat.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Finding matching cells then returning data of another cell

    perhaps it would be easier to help you if you uploaded a sample workbook, showing what data you are working with, a few examples of what your expected outcome would be, and how you would arrive at that (remove any confidential info if necessary).
    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
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    10-01-2012
    Location
    North Bay, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: Finding matching cells then returning data of another cell

    Here's a sample

    Sample.xlsx

  4. #4
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Finding matching cells then returning data of another cell

    The formula above concatenates only 2 of them. If there are more than 2 then it will take first 2.
    =INDEX($C$2:$C$6000,MATCH(1,(A2=$A$2:$A$6000)*(B2=$B$2:$B$6000),0))&CHAR(10)&INDEX($C$2:$C$6000,2) CSE
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-01-2012
    Location
    North Bay, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: Finding matching cells then returning data of another cell

    Many times I have alot more then two

    Any one else can help?

  6. #6
    Registered User
    Join Date
    10-01-2012
    Location
    North Bay, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: Finding matching cells then returning data of another cell

    And your formula always returns "9" which is not what I was looking for

  7. #7
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Finding matching cells then returning data of another cell

    try this in d1
    =IF(AND(A2=A3,B2=B3),C2&CHAR(10)&C3,IF(AND(A2=A1,B2=B1),C1&CHAR(10)&C2,""))

    select d1, double click the crosshairs (or drag down the entire list ...brrr )
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  8. #8
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Finding matching cells then returning data of another cell

    sorry missed the more than 2 match requirement...will try further experiments

  9. #9
    Registered User
    Join Date
    10-01-2012
    Location
    North Bay, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: Finding matching cells then returning data of another cell

    Doesn't seem to be working... :S

    Sample.xlsx

    Check it out...

    Thanks bud,

    Pat.

  10. #10
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Finding matching cells then returning data of another cell

    =index(if((a4=$a$2:$a$6000)*(b4=$b$2:$b$6000)=1,$c$2:$c$6000,""),1)&char(10)&iferror(index(if((a4=$a$2:$a$6000)*(b4=$b$2:$b$6000)=1,$c$2:$c$6000,""),2),"")&char(10)&iferror(index(if((a4=$a$2:$a$6000)*(b4=$b$2:$b$6000)=1,$c$2:$c$6000,""),3),"")&char(10)&iferror(index(if((a4=$a$2:$a$6000)*(b4=$b$2:$b$6000)=1,$c$2:$c$6000,""),4),"")&char(10)&iferror(index(if((a4=$a$2:$a$6000)*(b4=$b$2:$b$6000)=1,$c$2:$c$6000,""),5),"")

    cse

  11. #11
    Registered User
    Join Date
    10-01-2012
    Location
    North Bay, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: Finding matching cells then returning data of another cell

    Doesn't work... Can you send the workbook so I can see that it works on yours D:

  12. #12
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Finding matching cells then returning data of another cell

    not sure why the formula comes up #name in your sheet, worked fine (except for the not matching more than2...) on the sample I downloaded..

  13. #13
    Registered User
    Join Date
    10-01-2012
    Location
    North Bay, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: Finding matching cells then returning data of another cell

    Darn...

  14. #14
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Finding matching cells then returning data of another cell

    Because its an array formula it may slow your pc.
    Attached Files Attached Files

  15. #15
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Finding matching cells then returning data of another cell

    @eisayew...no kidding !!! I had to close the workbook so I could do ANYTHING else

  16. #16
    Registered User
    Join Date
    10-01-2012
    Location
    North Bay, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: Finding matching cells then returning data of another cell

    Lol seems to be working but why does it only work for the first few lines?

  17. #17
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Finding matching cells then returning data of another cell

    Quote Originally Posted by dredwolf View Post
    @eisayew...no kidding !!! I had to close the workbook so I could do ANYTHING else
    ok I will try it with sumproduct function

  18. #18
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: Finding matching cells then returning data of another cell

    I uploaded file but entered formula for the first 15 rows.
    =TRIM(INDEX(LARGE(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0),ROW(INDIRECT("1:"&SUM(--(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0)>0))))),1)&" "&IFERROR(INDEX(LARGE(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0),ROW(INDIRECT("1:"&SUM(--(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0)>0))))),2),"")&" "&IFERROR(INDEX(LARGE(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0),ROW(INDIRECT("1:"&SUM(--(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0)>0))))),3),"")&" "&IFERROR(INDEX(LARGE(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0),ROW(INDIRECT("1:"&SUM(--(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0)>0))))),4),"")&" "&IFERROR(INDEX(LARGE(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0),ROW(INDIRECT("1:"&SUM(--(IF((A2=$A$2:$A$15)*(B2=$B$2:$B$15)=1,$C$2:$C$15,0)>0))))),5),""))

    Later you may enlarge the function from 15 to whatever number you want
    Attached Files Attached Files

  19. #19
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Finding matching cells then returning data of another cell

    ok this isnt pretty, but ig gives you want you want...

    =IF(COUNTIF(E:E,E2)=1,E2, IF(E2=E1,H1, IF(E2=E3,C2&" "&C3& IF(E3=E4," "&C4& IF(E4=E5," "&C5& IF(E5=E6," "&C6,""),""),""),"")))

    However, it will be necessary for you to sort the data, because in some instances, the "match" is not on the next row down

  20. #20
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Finding matching cells then returning data of another cell

    came up with this

    =IF(AND(A2=A1,B2=B1),IF(D1<>"",D1&CHAR(10)&C2,C1&CHAR(10)&C2),"")

    however, the final combination will only show in the last consecutive matching cell..
    Attached Files Attached Files
    Last edited by dredwolf; 11-19-2012 at 03:44 PM. Reason: added sample

+ 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