Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8685689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:38:24+00:00 2026-06-12T22:38:24+00:00

I am trying to create a macro for an Excel file which has a

  • 0

I am trying to create a macro for an Excel file which has a column (let’s call this column A) of cells, and each cell contains 4 to 5 project Deliverables & Work Products separated by a comma, as well as identified by a tag “DEL” for Deliverable and “WKP” for Work Products.

I wish to accomplish the following with a Macro:

  1. I would like to keep column A as it is.
  2. Create a column B for Deliverables, which need to be extracted from cells in Col A
  3. Likewise, create a column C for Work Products, which need to be extracted from cells in Col A

Let me give an example:

Supposing Cell A1 contains

DEL1: DEL 1 Project Process, DEL2: DEL 2 Project Schedule, WKP1: WKP 1 Work Product Document

Here’s what I want Cell B1 to look like:

DEL1: DEL 1 Project Process, DEL2: DEL 2 Project Schedule

And Cell C1 to look like this:

WKP1: WKP1 Work Product Document

And mind you, not all the cells in Col A will be the exact character length as Cell A1. But they will contain both DELs and WKPs.

Given that the names of the Deliverables and Work Products vary in length, I cannot simply copy Col A and run TextToColumn in order to split it.

So far, the approach I have come up with is to copy Col A to Col B, retain the Deliverables and try to remove Work Products.

As you can see, this entails deleting the part of the string that starts with the comma (“,”) and space (” “) in front of “WKP” and ends with the last character of the Work Product in question (which in this case would be the last character of the entire string itself since it seems that the WKPs are mentioned right after DELs).

While I am able to write a Macro the can find the text “WKP” within each cell range and delete it, I am not able to delete the stuff that comes right after it. In other words, I am only able to produce this for Cell B1:

DEL1: DEL 1 Project Process, DEL2: DEL 2 Project Schedule, 1: 1 Work Product Document

Can someone help me write the Macro to do this? I would appreciate it if the syntax was also explained.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:38:25+00:00Added an answer on June 12, 2026 at 10:38 pm

    This should do the job. Call it using =WKP_DEL(A1,"DEL") in B1 and =WKP_DEL(A1,"WKP") in C1.

    Function WKP_DEL(str As String, DelOrWkp As String) As String
    
    Dim V() As String
    Dim SubStr As Variant
    Dim WKPs As String
    Dim DELs As String
        WKP_DEL = ""
        ' Split the string into an array
        V = Split(str, ",")
        ' Loop through the array adding WKPs to the WKPs string and DELs to the DELs string
        For Each SubStr In V
            If InStr(SubStr, "WKP") > 0 Then
                WKPs = WKPs & Trim(SubStr) & ", "
            End If
            If InStr(SubStr, "DEL") > 0 Then
                DELs = DELs & Trim(SubStr) & ", "
            End If
        Next
        ' Remove the trailing ", " and return the required string
        If DelOrWkp = "DEL" Then WKP_DEL = Left(DELs, Len(DELs) - 2)
        If DelOrWkp = "WKP" Then WKP_DEL = Left(WKPs, Len(WKPs) - 2)
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create an excel macro which is probably going to end
Little help here please . I am trying to create this lisp macro which
Trying to create a macro which can be used for print debug messages when
ok so im trying to create a macro that will take my set cells
We are trying to create an excel document which supports macros with some data
I'm trying to create a macro that produces in-cell graphing as seen over at
I am trying to write a macro in Excel which will allow me to
I'm trying to run an Excel macro from outside of the Excel file. I'm
I'm trying to create a Macro in Excel 2007 that will delete itself when
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.