Consulting

Results 1 to 11 of 11

Thread: Solved: Conditional Worksheet Column Comparison and Text Insert

  1. #1
    VBAX Regular
    Joined
    Apr 2011
    Posts
    18
    Location

    Solved: Conditional Worksheet Column Comparison and Text Insert

    Hi,

    Is it possible to compare a column of names in one worksheet (A) with a column of names in another worksheet (B) and if it exists in both, insert text into a column on the sheet (B)? I currently have one sheet named Payments with only names of people who made payments stored in column A:2 down and another sheet named Group of many people A:5 and down. I would like for the word “Paid” to be placed in Group column D of a groupmember whose name exists in payments. Is it possible to do this? I would sincerely appreciate any help.

    Thank you,
    Sisu

  2. #2
    VBAX Regular Chabu's Avatar
    Joined
    Dec 2010
    Location
    Brussels
    Posts
    85
    Location
    The easiest way (without VBA) is to use the VLOOKUP function

    In column D:5 of the group sheet put the following formula.
    =VLOOKUP(A5;Payments!A:A;1;FALSE)
    Then copy it downward for as far as there are names in column A.

    Greetings
    Bruno

  3. #3
    VBAX Regular Chabu's Avatar
    Joined
    Dec 2010
    Location
    Brussels
    Posts
    85
    Location
    probably "," instead of ";" for you

  4. #4
    VBAX Regular
    Joined
    Apr 2011
    Posts
    18
    Location
    I already have a three part IF(NUMBER formula in the destination cell that has its input based on the status listed in an adjacent cell. Ex if b is deceased then d is na. Can I add the lookup formula to this formula even though the original handles everything in the same sheet. Thanks.

  5. #5
    VBAX Regular Chabu's Avatar
    Joined
    Dec 2010
    Location
    Brussels
    Posts
    85
    Location
    I don't see why not. What is the other formula?

  6. #6
    VBAX Regular
    Joined
    Apr 2011
    Posts
    18
    Location
    =IF(ISNUMBER(SEARCH("Associate",B6)),"Unpaid",IF(ISNUMBER(SEARCH("Graduate" ,B7)),"N/A",IF(ISNUMBER(SEARCH("Deceased",B6)),"N/A",IF(ISNUMBER(SEARCH("Emeritus",B6)),"N/A"))))

  7. #7
    VBAX Regular Chabu's Avatar
    Joined
    Dec 2010
    Location
    Brussels
    Posts
    85
    Location
    would you mind sending the file (or an example version)?

  8. #8
    VBAX Regular
    Joined
    Apr 2011
    Posts
    18
    Location
    Chabu,

    Here is an example spreadsheet: Note in the column with the formula in the second sheet.
    Attached Files Attached Files

  9. #9
    VBAX Regular Chabu's Avatar
    Joined
    Dec 2010
    Location
    Brussels
    Posts
    85
    Location
    Why do you use search? Are the text values (like "Associate" part of longer text strings?
    If not then use data validation to restrict the values to the list you expect and simplify your formula (=IF(B6="Associate"...)
    What is the logic to fit in the VLOOKUP? (What do you want to achieve?

    send your sheet if possible.

    Greetings

  10. #10
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    Sisu,
    It looks to me that you have over-complicated things! In a non-Associate case all you want is N/A (Not Applicable) so you want to check in the case of Associate. If the associate's name appears in the payment sheet then payment is made. The following formula works for me (at least for all the cases you have given)
    =IF(B6<>"Associate","N/A",IF(ISERROR(VLOOKUP(A6,Payments!A:A,1,0)),"Unpaid","Paid"))
    Just a side question, not really important, does it pertain to professors / teaching? Last time I saw the Emeritus was (13 years back) on my Chemical Engineering coursebook....Professor Emeritus at Cornell University and the name of the book: Unit Operations of Chemical Engineering!

    PS: Chabu's suggestion of adding Data Validation is really good, you should look into it. Saves headaches!!
    Last edited by shrivallabha; 06-24-2011 at 09:31 AM. Reason: Has second thoughts!!
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

  11. #11
    VBAX Regular
    Joined
    Apr 2011
    Posts
    18
    Location
    Hi All,

    Yes Shriva this has something to do with academia. Yours and Chabu's code has helped.

    I realize now that what I am trying to do will not solve other issues I'm having with the same workbook. It is only a small piece of what must be done for this. For better or worse I am exclusively learning this language for some time. I will post back with a reply to my own question when I solve it. It may be some time until this happens. The thread will be deleted marked solved for now.

Posting Permissions

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