+ Reply to Thread
Results 1 to 5 of 5

Concatenating part of string in two columns into a new column

  1. #1
    Registered User
    Join Date
    04-20-2015
    Location
    Norway
    MS-Off Ver
    360
    Posts
    24

    Concatenating part of string in two columns into a new column

    Hi again!

    I could use some (more) help on a project I’m working on.
    I’m trying to concatenate two columns into a “new column A”. however, I only need part of the strings in each of the two columns:
    - The first 8 characters in column E
    - The last 2 characters in column H
    - Like this: EEEEEEEE-HH

    Problems with the code I have:
    1. It copies the whole strings in column E and H into the “new column A”
    2. Column H is formatted as dates, and I need the year to follow into the “new column A” – Not the value.

    The sheet is one of many and has an unknown number of rows. I’ve attached a short example of the data, as well as how I want the result to be after I run the code.

    I’ve also tried (but not been able) to modify a code by AlphaFrog found here:
    http://www.excelforum.com/excel-prog...ormatting.html

    The macro I'm using:
    Please Login or Register  to view this content.
    Any help is greatly appreciated!
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,904

    Re: Concatenating part of string in two columns into a new column

    Try this

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Concatenating part of string in two columns into a new column

    maybe so
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-20-2015
    Location
    Norway
    MS-Off Ver
    360
    Posts
    24

    Re: Concatenating part of string in two columns into a new column

    Thank you, alansidman and nilem! Both work perfectly

    Here is the final makro:
    Please Login or Register  to view this content.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,904

    Re: Concatenating part of string in two columns into a new column

    You are welcome and thanks for the rep

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Take part of the string out of a column of cells
    By cub246 in forum Excel General
    Replies: 4
    Last Post: 03-16-2015, 11:43 AM
  2. [SOLVED] Concatenating two columns and reversing after concatenating the result
    By irfanparbatani in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-22-2014, 09:35 PM
  3. [SOLVED] Concatenating values two columns (column B, column C) based on criterion
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2014, 11:31 AM
  4. Replies: 2
    Last Post: 02-28-2014, 06:42 PM
  5. [SOLVED] Counting entries in columns and concatenating headers in keyword column
    By lsmcal1984 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-08-2013, 05:52 AM
  6. [SOLVED] Extracting specific part of the text string to another column
    By ssanjju in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 01-20-2013, 07:20 PM
  7. Compare ranging part of a string in two columns
    By Jeroen79 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-04-2011, 09:52 AM

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