+ Reply to Thread
Results 1 to 11 of 11

Substitute parts of Entries by criteria list

  1. #1
    Registered User
    Join Date
    07-07-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    6

    Substitute parts of Entries by criteria list

    Hello everybody!

    I have a problem which I couldn't solve so far. I used the search function and google already but had no success.

    Here the problem:

    I have a list of filenames imported to Excel. The have the format "AMLF_716.jpg" for example.

    Now I have another list with two coloumns that identify the three digits code (in coloumn 1(here f.e. 716)) with a name (in coloumn 2(here f.e. Blue).

    As an output I need the new name AMLF~Blue.

    I would get it done with substitute if I just have a single value to replace, but with a whole list of criteria it exceeds my Excel skills.

    I hope one of you guys has an idea.

    I really apprechiate your help!

    Thanks,

    Raph
    Last edited by Raph81; 07-08-2010 at 10:40 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Substitute parts of Entries by criteria list

    Hello Ralph81,

    Welcome to the Forum!

    I have a few questions:
    1. What is the name of worksheet and which column are the file names in?
      I have a list of filenames imported to Excel. The have the format "AMLF_716.jpg" for example.
    2. What is the name of the worksheet that has the criteria?
    3. Where does the output to go?
    4. Do you have a sample workbook you can post?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    07-07-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Substitute parts of Entries by criteria list

    Hey Leith and thanks for helping and welcoming me

    I attached the spreadsheet.

    The whole thing is to convert filenames that of pictures that we have to put on a website and they have to have the format

    style~colorname

    The output can be just in another coloumn in the spreadsheet. This is not really important for me. It's gonna be copy/pasted anyways.

    THX,

    Raph
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-07-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Substitute parts of Entries by criteria list

    Ah, I just saw that I already replaced the _ by ~ to focus only on the 3 digits.

    And some more:

    when you look at the spreadsheet you can see that in this specific spreadsheet I already replaced some colorcodes by the names. But this is not important because I have the original data.

    On top of it there are colorcodes in the filenames that are not findable in the criterias.

    Sry for doublepost
    Last edited by Raph81; 07-07-2010 at 03:40 PM.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Substitute parts of Entries by criteria list

    Hello Raph81,

    This macro has been added to the attached workbook. All file names that have a matching color code are placed in column "B" of the "Filenames" worksheet.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-07-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Substitute parts of Entries by criteria list

    Thank you so much Leith,

    Excel can definitely be magic...

    I have some moer questions, because I don't just want to take your work, I want to learn.

    1) If I replace the criteria list by another one, does it still work? I mean, same place but different length?

    2) Is it possible to get an output where the color code is replaced by the name and if the code isn't findable in the list the output is the original?

    3)What are the sorting criterias for the output column?

    THX,

    Raph

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Substitute parts of Entries by criteria list

    Hello Raph,

    Q (1) If I replace the criteria list by another one, does it still work? I mean, same place but different length?

    A (1) If the criteria remain in columns "A" and "B" on worksheet "Colorcodes" then nothing needs to be changed. You can keep adding on to the list.

    Q (2) Is it possible to get an output where the color code is replaced by the name and if the code isn't findable in the list the output is the original?

    A (2) Column "B" of the "Filenames" contains the converted file names. That is the color code number is replaced by the color code description. Column "A" contains the original file names.

    Q (3) What are the sorting criteria for the output column?

    A (3) I don't understand this question.

  8. #8
    Registered User
    Join Date
    07-07-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Substitute parts of Entries by criteria list

    Hey Leith,

    to Q 2:

    My emphasis was more on the fact if it's possible to get a value back in case the code is NOT in the criteria list in colorcodes and this value should be the original filename.

    to Q 3:

    forget about it...

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Substitute parts of Entries by criteria list

    Hello Raph,

    Are you asking if it is possible to create 2 columns: 1 files that have a matching color code and 1 for those that don't? It is possible to separate the two types.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Substitute parts of Entries by criteria list

    Hello Raph,

    I modified the macro to replace only cells that have matching color codes in column "A". If the there is no color code then file name is unchanged.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-07-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Substitute parts of Entries by criteria list

    Hey Leith,

    my workday was over yesterday so I couldn't aswer you directly.

    Thanks for the 1a makro. I have really no idea about the code for the makro, but it's very interesting for me. Do you have a good source for information to get started in that field?

    I will compare the two codes to see the differences as soon as I have some time. Quite busy at the moment.

    You helped me a lot thank you very much!!!

    Raph

+ 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