+ Reply to Thread
Results 1 to 8 of 8

Excel formula that will insert a character from a table

  1. #1
    Registered User
    Join Date
    08-09-2012
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    14

    Excel formula that will insert a character from a table

    Hi,
    trying to figure out how to create a formula that will take a 8 char. string and based on what the 3rd char is, will add the 9th character from a table. See file for example. So, for 22BUA32A, the result will be 13 different parts all ending with different chars. for the 9th chars.
    thanks
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel formula that will insert a character from a table

    You don't have "B" as a 3rd character in your table.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    08-09-2012
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel formula that will insert a character from a table

    ok, I added the "B" to the table, any ideas?
    Attached Files Attached Files

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,725

    Re: Excel formula that will insert a character from a table

    Please provide more samples of desired output. This not all clear (to me).
    Dave

  5. #5
    Registered User
    Join Date
    08-09-2012
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel formula that will insert a character from a table

    Ok, i've added sample output to my file
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-30-2019
    Location
    Orlando Florida
    MS-Off Ver
    10
    Posts
    3

    Re: Excel formula that will insert a character from a table

    The pattern is not clear.
    I can extract the third character from a string of any length using =RIGHT(LEFT(A17,3),1)
    For "22BUA32A" the answer is B.

    I do not see how to interpret "B" as the 9th character.

    If B is the column for the table, then the next entry does not make sense as 22CUA32A would refer to column C where the 9th cell is empty.
    Column C is "3rd character" but J is not the third character in any of the 8 character codes nor is it the third character in any of the columns.
    I note that the number of characters in the columns decreases, but I have no idea why.

    Often the best first step is to clearly define all the elements that make the pattern.

  7. #7
    Registered User
    Join Date
    08-09-2012
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel formula that will insert a character from a table

    ok, here is what i'm trying to do:
    if the 3rd char in A17 is any of the chars in A2, then the output should look like B17 thru B29
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-30-2019
    Location
    Orlando Florida
    MS-Off Ver
    10
    Posts
    3

    Re: Excel formula that will insert a character from a table

    That helps. Thank you.
    My first "solution" is to unpack the string in A2 in J.
    I can then use countif to see if there is a match in the third letter, and nest this in an if to test for that match and then join strings using & in cells J17 through J29.

    The method is not generic, though it will work with any string of fewer than 8 letters in A2. I tested the other columns, and it seems to give the correct output. I added a B in cell G2 to see what would happen.

    I intended to attach a file. In case it does not make it here is what I did.

    Cell J2: enter =left(A2,1)
    Cell J3: enter =right(left(a2,3),1)
    Cell J4: enter =right(left(a2,5),1)
    Keep going until cell j9 where you enter =right(left(a2,15),1)

    Cell J17
    =IF(B2="","",IF(COUNTIF(J$2:J$9,RIGHT(LEFT($A$17,3),1))>0,$A$17&B2,""))
    Fill down to cell J29.



    generic, though it will work with any string of fewer than 8 letters in A2. I tested the other columns, and it seems to give the correct output. I added a B in cell G2 to see what would happen.

+ 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. [SOLVED] Formula Remove slashes, insert X in front of first character and remove last to characters
    By Howardc1001 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-29-2020, 03:31 AM
  2. [SOLVED] Insert formula into table so that it carries down entire table column length
    By carlito2002wgn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-12-2019, 10:26 AM
  3. Import XML Table into Excel with Special Character in Header
    By alintz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-31-2018, 03:49 PM
  4. Replies: 10
    Last Post: 09-15-2015, 04:53 PM
  5. [SOLVED] if a string doesn't contain a character insert that character.
    By LenaK in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 01-31-2015, 12:54 PM
  6. How to insert Japanese character to SAP from Excel?
    By rafeemd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2013, 06:30 AM
  7. Replies: 3
    Last Post: 11-08-2012, 05:01 PM

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