+ Reply to Thread
Results 1 to 16 of 16

match and put values

  1. #1
    Forum Contributor
    Join Date
    07-05-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    100

    match and put values

    As attached sample, I want to put the value in the C column to column F , if the column A and B match with column D and E.
    Attached Files Attached Files
    Last edited by naflas; 10-29-2010 at 01:07 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,334

    Re: match and put values

    How about:
    =IF(AND(A1=D1,B1=E1),C1,"")

  3. #3
    Forum Contributor
    Join Date
    07-05-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: match and put values

    Quote Originally Posted by MarvinP View Post
    How about:
    =IF(AND(A1=D1,B1=E1),C1,"")
    No...

    coulmn A and B have 9000 rows and coulmn D and E have only 300 rows.

  4. #4
    Forum Contributor pr4t3ek's Avatar
    Join Date
    10-13-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2003 & 2007, 2010
    Posts
    483

    Re: match and put values

    Here you go.

    Please Login or Register  to view this content.
    Note: the value will work as is. e.g.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    i hope this makes sense?
    Last edited by pr4t3ek; 10-28-2010 at 09:04 PM.
    --
    Regards
    PD

    ----- Don't Forget -----

    1. Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks

    2. Thank those who have helped you by Clicking the scales above each post.

    3. Please mark your post [SOLVED] if it has been answered satisfactorily.

  5. #5
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: match and put values

    Quote Originally Posted by naflas View Post
    No...

    coulmn A and B have 9000 rows and coulmn D and E have only 300 rows.
    then under your original criteria =IF(A1:B1=D1:E1,C1,"") would result in some matches up to rows 300 and thereafter when column A:B was showing "" Blank.

    What would be your expected answer after rows 300?
    Windows 7 using Office 2007 & 2010

    Remember your [ code ] [ /code ] tags, makes reading soooo much easier

  6. #6
    Forum Contributor
    Join Date
    07-05-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: match and put values

    Quote Originally Posted by scottylad2 View Post
    then under your original criteria =IF(A1:B1=D1:E1,C1,"") would result in some matches up to rows 300 and thereafter when column A:B was showing "" Blank.

    What would be your expected answer after rows 300?
    Hi ,

    After 300 rows its balnk

  7. #7
    Forum Contributor pr4t3ek's Avatar
    Join Date
    10-13-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2003 & 2007, 2010
    Posts
    483

    Re: match and put values

    how did my code go naflas?

  8. #8
    Forum Contributor
    Join Date
    07-05-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: match and put values

    Quote Originally Posted by pr4t3ek View Post
    Here you go.

    Please Login or Register  to view this content.
    Note: the value will work as is. e.g.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    i hope this makes sense?
    Thanks for your answer.
    When I run it gives "run time error '13""

    Type mismatch


    the values in the coulmns have as follows

    war.frs.001
    BUD-458
    ...
    ..

  9. #9
    Forum Contributor pr4t3ek's Avatar
    Join Date
    10-13-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2003 & 2007, 2010
    Posts
    483

    Re: match and put values

    can you post your workbook because i tested this based on the workbook that you gave me and it worked fine.

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,334

    Re: match and put values

    Hi Guys,

    Reading the code above with the
    Please Login or Register  to view this content.
    Made me wonder if all three variables would be Dimed as Strings. The answer is - Only the Last and perhaps the reason for runtime error.

    Read http://www.cpearson.com/excel/declaringvariables.aspx
    Section of Pay Attention To Variables Declared With One Dim Statement

  11. #11
    Forum Contributor
    Join Date
    07-05-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: match and put values

    Quote Originally Posted by MarvinP View Post
    Hi Guys,

    Reading the code above with the
    Please Login or Register  to view this content.
    Made me wonder if all three variables would be Dimed as Strings. The answer is - Only the Last and perhaps the reason for runtime error.

    Read http://www.cpearson.com/excel/declaringvariables.aspx
    Section of Pay Attention To Variables Declared With One Dim Statement
    Error on the following line

    If ci.Value = tempvalue1 And ci.Offset(0, 1).Value = tempvalue2 Then

  12. #12
    Forum Contributor pr4t3ek's Avatar
    Join Date
    10-13-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2003 & 2007, 2010
    Posts
    483

    Re: match and put values

    my code is assuming it looks exactly the same as your example workbook. like i said, please paste your workbook for a quick solution.

  13. #13
    Forum Contributor
    Join Date
    07-05-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: match and put values

    Quote Originally Posted by pr4t3ek View Post
    my code is assuming it looks exactly the same as your example workbook. like i said, please paste your workbook for a quick solution.
    Hi ,

    I can not sen the docuement. Your code is work ing fine with the docuement I attached. But the problem is when include 9000 rows in to coulmn A and B it gives error

  14. #14
    Forum Contributor pr4t3ek's Avatar
    Join Date
    10-13-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2003 & 2007, 2010
    Posts
    483

    Re: match and put values

    try this

    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    07-05-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: match and put values

    Solved , ur the number 1.

    Thank u so much

  16. #16
    Forum Contributor pr4t3ek's Avatar
    Join Date
    10-13-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2003 & 2007, 2010
    Posts
    483

    Re: match and put values

    no probs, cheers boss!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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