+ Reply to Thread
Results 1 to 10 of 10

Extract existing IDs of entries repeated in a worksheet in a separate column

  1. #1
    Registered User
    Join Date
    12-29-2009
    Location
    Milwaukee, US
    MS-Off Ver
    Excel 2007
    Posts
    25

    Extract existing IDs of entries repeated in a worksheet in a separate column

    Hi,
    I have some test scripts that I track in an excel sheet. Each script has several attributes like status, module that it belongs to etc. Some scripts are common among other modules as well. So, from a script writing stand-point, the tester needs to know that the script he/ she are writing, which other modules require it. So that he/ she may save some time and reuse the existing scripts. So, I need some help in writing an excel macro/ solution to the following:

    1. In a new column named ‘Common with’ the solution searches the script name column and wherever it finds same name script (regardless of module), that script’s ID is noted and written in the ‘Common with’ column.
    2. If more than one repetition is found then, separate the IDs in the common with column with commas.
    3. The solution must incorporate the logic that if a script’s repetition isn’t found then, ‘NONE’ is entered in the ‘Common with’ column.

    So, I made a sample sheet and attached herewith. I would highly appreciate if you could please help me in this. Appreciate your help!
    Attached Files Attached Files

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

    Re: Extract existing IDs of entries repeated in a worksheet in a separate column

    If you add this function to your VB Editor (ALT+F11, Insert|Module)

    Please Login or Register  to view this content.
    Then use formula:

    Please Login or Register  to view this content.

    confirmed with CTRL+SHIFT+ENTER
    not just ENTER and copy down.
    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
    12-29-2009
    Location
    Milwaukee, US
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Extract existing IDs of entries repeated in a worksheet in a separate column

    OK thanks..! Worked very well. Could you suggest, where to edit, if I want that ID of a script with 'Removed' status (regardless of its repetition) is not entered in the 'Common with' 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: Extract existing IDs of entries repeated in a worksheet in a separate column

    Sorry can you repeat that? I don't understand the question.

  5. #5
    Registered User
    Join Date
    12-29-2009
    Location
    Milwaukee, US
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Extract existing IDs of entries repeated in a worksheet in a separate column

    Sure. So, if a script has a status of 'Removed' then, I don't want that script's ID listed in the 'Common with' column. Is that possible..?

    Thanks a lot..!!!

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

    Re: Extract existing IDs of entries repeated in a worksheet in a separate column

    Do you mean?

    Please Login or Register  to view this content.
    CSE key confirmed and copied down.

    Edit: The UDF function should be Aconcat...changed.
    Last edited by NBVC; 06-06-2011 at 03:36 PM. Reason: Aconcat... should've be Aconcat!

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

    Re: Extract existing IDs of entries repeated in a worksheet in a separate column

    Note, I had put in the wrong function name above.. it should be ACONCAT.... I fixed above post.

  8. #8
    Registered User
    Join Date
    12-29-2009
    Location
    Milwaukee, US
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Extract existing IDs of entries repeated in a worksheet in a separate column

    Thanks..! Worked. I just added a little change:

    =IF(C2="Removed","NA",IF(TRIM(SUBSTITUTE(" "&ACONCAT(IF($B$2:$B$16=B2,$A$2:$A$16,"")," ")&" "," "&A2&" "," "))="","None",SUBSTITUTE(TRIM(SUBSTITUTE(" "&ACONCAT(IF($B$2:$B$16=B2,$A$2:$A$16,"")," ")&" "," "&A2&" "," "))," ",", ")))

  9. #9
    Registered User
    Join Date
    12-29-2009
    Location
    Milwaukee, US
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Extract existing IDs of entries repeated in a worksheet in a separate column

    One more thing..when the logic searches the test script name column, then, it should list ID(s) of the duplicate script name. However, it also lists the parent entry as well. I mean, for example, if first row has script id = '1' and script name is 'ABC'. The logic must search the script name column and if it finds the same name script in rows 25 and 25 below, then it should list the numbers 24 and 25 respectively and not 1, 24, 25...!

    Could you suggest how to facilitate this?

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

    Re: Extract existing IDs of entries repeated in a worksheet in a separate column

    Can you show what you mean?

    My formula is designed not to include the ID that is in the same row of the formula, I assume you are not repeating ID numbers.. just ScriptName and/or Statuses... correct?

    Make sure to confirm with CTRL+SHIFT+ENTER and also make sure your column B is clear of extra spaces. Your sample has an extra space after Forecast in B4 and B9 so when you enter the formula in E2, it initially and incorrectly states "None", but after removing those spaces in should give result of "3, 8"

+ 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