+ Reply to Thread
Results 1 to 11 of 11

Vlookup of 1 cell containing multiple search arguments

  1. #1
    Registered User
    Join Date
    04-13-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    7

    Cool Vlookup of 1 cell containing multiple search arguments

    Hi,

    Spreadsheet 1
    Cell A1: Document reference
    Cell A2 = contains (list of numbered action items associated to the specified document in A1)[list is separated by commas within this cell)

    Spreadsheet 2
    A1: A4 contains the numbered action item
    B1: B4 gives the status per action item (IE. open, closed)

    I want to find a way take all the listed action items within Cell A2 and cross reference them with spreadsheet 2 to return all the associated status's.

    Ideally then highlight the row, if any action item is found to still be open in that second spreadsheet. Or alternatively highlight the row if all action items are found to be closed.

    I had gotten as far as a Vlookup that returns the status, but this only works if only one action item is listed in cell A2 of sheet 1.

    I would greatly appreciate it if someone with advanced excel skills could help me out!

    Thanks!
    Last edited by MSazza; 04-15-2011 at 10:05 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vlookup of 1 cell containing multiple search arguments

    I seem to be using this one a lot today....

    Apply this UDF to your workbook (ALT+F11, Insert|Module) and then paste:

    Please Login or Register  to view this content.
    Then in B2 of Sheet1:

    =SUBSTITUTE(TRIM(aconcat(IF(ISNUMBER(SEARCH(" "&Sheet2!$A$2:$A$4&" "," "&SUBSTITUTE(A2,","," ")&" ")),Sheet2!$B$1:$B$4,"")," "))," ",",")

    confirmed with CTRL+SHIFT+ENTER not just ENTER

    Then to Conditionally format, invoke Conditional Formatting, select New Rule, then select Use a formula to determine which cellls to format and enter formula:

    =SEARCH("open",$B2)

    click Format and choose colour.
    Attached Files Attached Files
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    04-13-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Vlookup of 1 cell containing multiple search arguments

    I really need to Thank you for all that information. So far everything has worked beautifully. I just had two more question, is there a way to tweak the formula to recognize the list in cell A2 separated by both a comma and a space? I forgot to mention the action items are separate by comma AND space. Not a big deal, I deleted the spaces and the formula worked great.

    I have a second question. I applied the conditional formatting to a particular row based upon that B2 cell. It works but how would drag or apply the conditional formatting (hoping the formula updates based on B3, B4 ect) without having to do conditional formatting per column?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vlookup of 1 cell containing multiple search arguments

    You'd have to give me examples for the first question. I tried adding a space and commas and it still worked for me... (my samples were as per the attachment above).

    For the custom formatting, if you select that cell that the format is applied to to Conditional Formatting menu and select Manage Rules, then select the rule and just update the range in the applies to field on the right to include the whole column B range you want to apply the format to.

  5. #5
    Registered User
    Join Date
    04-13-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Vlookup of 1 cell containing multiple search arguments

    Strange originally it was giving me 0s when i had the spaces included, but it seems to be working now. And what you told me to do for the conditional formatting has also worked!! Awesome help! Thank you very much, I would never have figured that out on my own!

  6. #6
    Registered User
    Join Date
    04-13-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Vlookup of 1 cell containing multiple search arguments

    Hi Again,

    All the above worked when I had two spreadsheets within the same directory on my local drive, now that I am trying it out with the original versions of the spreadsheets (on a shared drive in different directories) there are no results being returned. (I've performed all the same steps and entered the formulas exactly the same).

    Thanks Again in Advance.

  7. #7
    Registered User
    Join Date
    04-13-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Vlookup of 1 cell containing multiple search arguments

    this is the modified formula as it pertains to my spreadsheet.

    =SUBSTITUTE(TRIM(aconcat(IF(ISNUMBER(SEARCH(" "&'G:\Benefits\BERS\04 Rollout-II LOB\02 Specifications\00 Specs Tracking\[Project Issue List Current_1.xls]Other Issues'!$A$2:$A$329&" "," "&SUBSTITUTE(AH6,","," ")&" ")),'G:\Benefits\BERS\04 Rollout-II LOB\02 Specifications\00 Specs Tracking\[Project Issue List Current_1.xls]Other Issues'!$H$2:$H$329,"")," "))," ",",")

    Seems to be bringing in for some rows no results and others showing every status irregarless of what action items were listed.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vlookup of 1 cell containing multiple search arguments

    I just tested it with the same workbook I last attached, separating the Sheet2 data into a totally separate workbook and closed that workbook. I didn't seem to have a problem.

    Any way you can provide sample of the 2 workbooks? (just remove/replace confidential data) and make them brief enough to illustrate the point...

  9. #9
    Registered User
    Join Date
    04-13-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Vlookup of 1 cell containing multiple search arguments

    Ok this time, It seems that after I held down the CTRL+Shift+Enter for a few seconds longer, it just started working. Not sure if that was what did it, but it was the only thing i did different.

    Now I have another request, really testing you here sorry for the bother.

    Recall:
    A2: contained a list of action items

    sheet 2: was the spreadsheet which contained all the action items with their status.

    What if I wanted to return the particular listed action item(s) in A2 that shows a status of "Open" in sheet 2? Does that change the formula alot?

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vlookup of 1 cell containing multiple search arguments

    Using same workbook I posted above again... try:

    Please Login or Register  to view this content.

    confirmed with CTRL+SHIFT+ENTER

  11. #11
    Registered User
    Join Date
    04-13-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Vlookup of 1 cell containing multiple search arguments

    The formula had been working well, (again this is on a share drive) then one of my co-workers open the spreadsheet and it begun returning 0s in addition to the action items.. I looked at the VB code, the formula, the linked spreadsheet and there's been no change. The 0's just appear as a nuisance. Any ideas what could have changed?

+ 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