+ Reply to Thread
Results 1 to 13 of 13

looking for best formulation for my issue

  1. #1
    Registered User
    Join Date
    02-24-2009
    Location
    Tehran
    MS-Off Ver
    Excel 2010
    Posts
    45

    looking for best formulation for my issue

    Hi,

    I have two worksheets( W1 & W2). I need to update value of Column "C" in W1 and show updated value in Column "D" of W1.
    To update value of column "C" I need to compare value of column "A" and column "B" for each row in W1 with available rows for columns "A" & "B" in W2 worksheet and if they are exactly equal then check for the correspond value of column "C" of W2 and if the value of column "C" of W2 is equal to value of column "C" of W2 then insert same value in Column "D" of W1 else select the value of column "C" in W2 as new value and insert in column "D" of W1. Finally if the value of "A" & "B" columns in both worksheets are not equal then just simply return "DIFFERENT" statement in column "D" of W1.

    I like to know what are the best formulation ways to do it.

    Thank you in advance.
    Attached Files Attached Files
    Last edited by omid020; 04-08-2017 at 03:43 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: looking for best formulation for my issue

    There is nothing in your sample workbook that matches your final criterion, but try this:

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    1
    INPUT INDEX OUTPUT NEW OUTPUT
    2
    A1236
    6
    36
    36
    3
    A2589
    8
    24
    39
    4
    A3662
    2
    32
    32
    5
    A1561
    1
    69
    69
    6
    A1236
    4
    14
    35
    7
    A3662
    3
    19
    19
    8
    A2589
    1
    20
    30
    9
    A3662
    3
    45
    19
    Sheet: W1

    Excel 2016 (Windows) 32 bit
    D
    2
    =IFERROR(INDEX('W2'!$C$2:$C$9,MATCH(1,(A2='W2'!$A$2:$A$9)*(B2='W2'!$B$2:$B$9),0)),"Different")
    Sheet: W1

    ... confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Last edited by AliGW; 04-08-2017 at 03:22 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: looking for best formulation for my issue

    Please let us know what would be your expected result in your attached file???
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  4. #4
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: looking for best formulation for my issue

    Hi

    in D2 to be copied down

    =SUMPRODUCT('W2'!$C$1:$C$1000,('W2'!$A$1:$A$1000=A2)*('W2'!$B$1:$B$1000=B2))


    in E2

    =IF(C2=D2,"","DIFFERENT")


    Regards
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: looking for best formulation for my issue

    Try in D2 W1:

    =IFERROR(LOOKUP(2,1/('W2'!A:A=A2)/('W2'!B:B=B2),'W2'!C:C),"Different")
    Quang PT

  6. #6
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: looking for best formulation for my issue

    Or Try

    =IF(C2=INDEX('W2'!C:C,MATCH(A2&B2,INDEX('W2'!A:A&'W2'!B:B,),0)),C2,"DIFFERENT")

  7. #7
    Registered User
    Join Date
    02-24-2009
    Location
    Tehran
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: looking for best formulation for my issue

    Quote Originally Posted by bebo021999 View Post
    Try in D2 W1:

    =IFERROR(LOOKUP(2,1/('W2'!A:A=A2)/('W2'!B:B=B2),'W2'!C:C),"Different")
    This works very well! Thank you bebo!

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: looking for best formulation for my issue

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

    It might also be courteous to say 'thank you' to all those who tried to help - you were given four different solutions within a quarter of an hour!

  9. #9
    Registered User
    Join Date
    02-24-2009
    Location
    Tehran
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: looking for best formulation for my issue

    Quote Originally Posted by AliGW View Post
    There is nothing in your sample workbook that matches your final criterion, but try this:

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    1
    INPUT INDEX OUTPUT NEW OUTPUT
    2
    A1236
    6
    36
    36
    3
    A2589
    8
    24
    39
    4
    A3662
    2
    32
    32
    5
    A1561
    1
    69
    69
    6
    A1236
    4
    14
    35
    7
    A3662
    3
    19
    19
    8
    A2589
    1
    20
    30
    9
    A3662
    3
    45
    19
    Sheet: W1

    Excel 2016 (Windows) 32 bit
    D
    2
    =IFERROR(INDEX('W2'!$C$2:$C$9,MATCH(1,(A2='W2'!$A$2:$A$9)*(B2='W2'!$B$2:$B$9),0)),"Different")
    Sheet: W1

    ... confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    It works vey nice but I think this one is better because it does not use arrays and is less complicated
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-24-2009
    Location
    Tehran
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: looking for best formulation for my issue

    Quote Originally Posted by AliGW View Post
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

    It might also be courteous to say 'thank you' to all those who tried to help - you were given four different solutions within a quarter of an hour!
    Yep, you are right! Thank you all!
    Last edited by omid020; 04-08-2017 at 03:45 AM.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: looking for best formulation for my issue

    Quote Originally Posted by omid020 View Post
    It works vey nice but I think this one is better because it does not use arrays and is less complicated
    Please Login or Register  to view this content.
    Whichever you choose, of course, but all the solutions offered work.

    Please don't forget to mark the thread as solved.

  12. #12
    Registered User
    Join Date
    02-24-2009
    Location
    Tehran
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: looking for best formulation for my issue

    Quote Originally Posted by AliGW View Post
    Whichever you choose, of course, but all the solutions offered work.

    Please don't forget to mark the thread as solved.
    @AliGW your suggestion is very good for some conditions which two sheets have not same sort. Thank you so much!

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: looking for best formulation for my issue

    You're welcome!

+ 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. If Formulation (Or maybe more)
    By Angelicvamp in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-05-2015, 11:21 PM
  2. DAy FORMULATION
    By bginn in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-11-2013, 01:03 PM
  3. Formulation Question
    By bsp12 in forum Excel General
    Replies: 2
    Last Post: 05-21-2012, 02:52 AM
  4. Reference Formulation
    By jamiey_jacob in forum Excel General
    Replies: 0
    Last Post: 08-19-2011, 02:54 PM
  5. RE: If formulation: Is it possible...
    By OSCAR in forum Excel General
    Replies: 3
    Last Post: 12-31-2005, 03:55 AM
  6. [SOLVED] If formulation
    By OSCAR in forum Excel General
    Replies: 2
    Last Post: 12-31-2005, 02:10 AM
  7. Time formulation?
    By LGrobe in forum Excel General
    Replies: 1
    Last Post: 08-16-2005, 02:05 PM

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