+ Reply to Thread
Results 1 to 12 of 12

A formula to compare to two columns and provide a value to another column if value is true

  1. #1
    Registered User
    Join Date
    07-20-2011
    Location
    Kerala, India
    MS-Off Ver
    Excel 2013
    Posts
    93

    Thumbs up A formula to compare to two columns and provide a value to another column if value is true

    Hi! am using windows 7 Professional and MS Office 2013

    I have "Columns A and C" with some Medicine names
    If "Column C" value matches exact values of any "Column A" values
    Then the consecutive "Column B" of "Column A" should return a Value: 5
    and leave blank if False

    I appreciate your early reply

    Please refer to the attachment
    Sheet:"1" explains my requirement
    Sheet: "Result" is desired output
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: A formula to compare to two columns and provide a value to another column if value is

    Try this:

    =IF(SUMPRODUCT(--(NOT(ISERR(SEARCH($C$1:$C$10,A1)))))>0,5,"")
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    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,830

    Re: A formula to compare to two columns and provide a value to another column if value is

    Please update the details in your forum profile to reflect the version you are using.
    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.

  4. #4
    Registered User
    Join Date
    07-20-2011
    Location
    Kerala, India
    MS-Off Ver
    Excel 2013
    Posts
    93

    Smile Re: A formula to compare to two columns and provide a value to another column if value is

    Thanks a lot!
    I really appreciate your early reply!

  5. #5
    Registered User
    Join Date
    07-20-2011
    Location
    Kerala, India
    MS-Off Ver
    Excel 2013
    Posts
    93

    Re: A formula to compare to two columns and provide a value to another column if value is

    Quote Originally Posted by Glenn Kennedy View Post
    Try this:

    =IF(SUMPRODUCT(--(NOT(ISERR(SEARCH($C$1:$C$10,A1)))))>0,5,"")
    Hi!
    Highly appreciate your early reply:

    One more suggestion: When the comparison result is "FALSE", rather than making it "BLANK" can it be left as it is..... with the Values which were there before

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: A formula to compare to two columns and provide a value to another column if value is

    By "the Values which were there before"... do you mean the value in column A... or what?

    If you mean the value in column A:

    =IF(SUMPRODUCT(--(NOT(ISERR(SEARCH($C$1:$C$10,A1)))))>0,5,A1)

  7. #7
    Registered User
    Join Date
    07-20-2011
    Location
    Kerala, India
    MS-Off Ver
    Excel 2013
    Posts
    93

    Re: A formula to compare to two columns and provide a value to another column if value is

    Quote Originally Posted by Glenn Kennedy View Post
    By "the Values which were there before"... do you mean the value in column A... or what?

    If you mean the value in column A:

    =IF(SUMPRODUCT(--(NOT(ISERR(SEARCH($C$1:$C$10,A1)))))>0,5,A1)
    Sorry, forgot to mention
    I meant with "Column B" existing values

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: A formula to compare to two columns and provide a value to another column if value is

    1. What original values in column B? in your example they are all blank!!

    2. You can have a formula or a value in a cell.

  9. #9
    Registered User
    Join Date
    07-20-2011
    Location
    Kerala, India
    MS-Off Ver
    Excel 2013
    Posts
    93

    Thumbs up Re: A formula to compare to two columns and provide a value to another column if value is

    Quote Originally Posted by Glenn Kennedy View Post
    1. What original values in column B? in your example they are all blank!!

    2. You can have a formula or a value in a cell.
    1. If any values is existing in "Column B" it should return Column B value ... Formula should skip
    2. In my sheet it was not mentioned (i have made corrections)


    Please refer to the attachment.
    Attached Files Attached Files

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: A formula to compare to two columns and provide a value to another column if value is

    The formula cannot skip... not in the same column. So is this acceptable?

    otherwise you will need VBA
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-20-2011
    Location
    Kerala, India
    MS-Off Ver
    Excel 2013
    Posts
    93

    Re: A formula to compare to two columns and provide a value to another column if value is

    This is ok

    Thank you very much.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: A formula to compare to two columns and provide a value to another column if value is

    You're welcome.



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

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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. Replies: 3
    Last Post: 01-11-2018, 04:41 AM
  2. Replies: 6
    Last Post: 09-21-2016, 04:21 PM
  3. Compare two sheets columns and if true change row color
    By Vanth_2013 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2016, 09:57 AM
  4. [SOLVED] compare 2 columns provide result in 3rd column
    By snakesbee in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-29-2015, 11:34 AM
  5. [SOLVED] Compare 3 concatenated columns with another and update if true
    By m4k3n5h1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-29-2014, 05:40 PM
  6. Compare 3 columns, if true delete row
    By jsteinmetz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-22-2010, 06:08 PM
  7. Need a formula to lookup, compare, provide result
    By dklein2149 in forum Excel General
    Replies: 1
    Last Post: 02-06-2009, 12:55 AM

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