+ Reply to Thread
Results 1 to 12 of 12

Return data after and up to a certain Alphabet Letter??

  1. #1
    Registered User
    Join Date
    04-20-2017
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    2

    Return data after and up to a certain Alphabet Letter??

    Good morning all,

    I have a predicament with a sheet I am trying to make work but just can seem to get it right. Maybe one of you experts could assist?

    We barcode scan stock into excel and need to break the scanned code down to 3 differ blocks denoting, location, part number and quantity. The problem I have is that the character lengths vary and thus a left or right function does not work. Is there a formula that tells excel to return data based on an alphabet letter.

    My thoughts would be to do a formula that will return data from the scanned code starting and including "M" (Will always start with M) up to and excluding S or T or H or what ever alphabetical letter comes up and so on.

    Below example is what we are trying to achieve. (Location, Stock Code and Quantity needs to populated using a formula)

    I have attached an sample sheet of what we need to do

    A1 B1 C1 D1
    Barcode Scan Location Stock Code Quantity
    MB001S13-2121Q009 MB001 S13-2121 Q009
    MB01S13-2121Q9 MB01 S13-2121 Q9
    MB1S13-2121Q09 MB1 S13-2121 Q09
    MB001T7040-1217Q015 MB001 T7040-1217 Q015
    MB001T633-1212Q1 MB001 T633-1212 Q1
    MB01S116-323232Q119 MB01 S116-323232 Q119
    Attached Files Attached Files
    Last edited by Golombick; 04-20-2017 at 02:44 AM.

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Return data after and up to a certain Alphabet Letter??

    try in B
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In C
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In D

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I do not expect that it will work on other instances..

    I rely on the idea where your Location ends with the value of 1 e.g. MB00001

    and the QTY starts with Q e.g. Q0007
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  3. #3
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Return data after and up to a certain Alphabet Letter??

    Hi
    the final column is easy (assuming there is no Q in the earlier codes, otherwise we'll have to tweak it):

    =RIGHT(A2,LEN(A2)-FIND("Q",A2)+1)

    but where to split the location is problematic eg there is no letter between the location and stock codes here:

    MB00169000N-32Q9

    is there another way to tell excel where to split, eg location always ends in 1 or 01?

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,208

    Re: Return data after and up to a certain Alphabet Letter??

    Removed by JT

  5. #5
    Registered User
    Join Date
    04-20-2017
    Location
    South Africa
    MS-Off Ver
    2010
    Posts
    2

    Re: Return data after and up to a certain Alphabet Letter??

    Hi Vladimir,

    All looks great but one variable is that the location can be any thing from MB01 to MB9999, Thus it changes parameters and would one able to a =LEFT(A2,MIN(FIND(1 to 9,A2&"1"))) for example

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,208

    Re: Return data after and up to a certain Alphabet Letter??

    In the example given by NickyC:

    MB00169000N-32Q9

    there is no way to identify where the Location finishes and Stock Code starts

    MB09169000N-32Q9

    Is location MB09, MB091 .....????

  7. #7
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Return data after and up to a certain Alphabet Letter??

    Going back to JT request. can you post possible scenarios. and also the question of Nicky
    is there another way to tell excel where to split, eg location
    e.g.

    MB00169000N-32Q9 -> in this example from row 7 how do we know or you know where to split?

    Edit: Sorry JT... didn't able to refresh before posting.

  8. #8
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Return data after and up to a certain Alphabet Letter??

    Hi
    one of the forum gurus could probably do this in a formula, but I could at least do it in a user-defined function:
    1. find the position of the first number in the string (the earliest point at which the part number code starts)
    2. find the position of the first letter in the string after this (where the part number is most likely to start)
    3. use this to split the first two positions


    this will only work where:
    • the location format is one or more letters followed by one or more numbers
    • the part number code starts with a letter

    would this be helpful?

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Return data after and up to a certain Alphabet Letter??

    In B2:
    =LEFT(A2,SEARCH("1",A2))

    In C2:
    =LEFT(SUBSTITUTE(A2,B2,""),SEARCH("Q",SUBSTITUTE(A2,B2,""))-1)

    In D2:
    =SUBSTITUTE(A2,B2&C2,"")
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  10. #10
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Return data after and up to a certain Alphabet Letter??

    Hi
    try these functions

    I have created 3 for completeness, although the Qty column is easy to do with formulas

    if you're not familiar with user-defined functions, just copy them into your VBA area as you would a macro and then use them as you would a built-in in Excel function e.g.

    =location(A2)

    should return

    MB1

    Please Login or Register  to view this content.
    if this returns what you are after, but you don't want to use user-defined formulas, the code could very easily be converted to macros that would return values
    Last edited by NickyC; 04-20-2017 at 05:00 AM. Reason: added information

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,208

    Re: Return data after and up to a certain Alphabet Letter??

    @GK: Location does not always end in "1": see #5.

    Coffee time ?? !!!

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Return data after and up to a certain Alphabet Letter??

    Yea, JT...

    If A8 can really occur - this is impossible to solve...
    Last edited by Glenn Kennedy; 04-20-2017 at 05:48 AM.

+ 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. Formula to search database and return data based on alphabet (NEED HELP)
    By galbatrox9 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-19-2016, 02:58 PM
  2. [SOLVED] Loop to next letter in Alphabet if condition met.
    By YOO629 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-04-2015, 03:31 PM
  3. Lets Remove the Letter F from our Alphabet
    By Mordred in forum The Water Cooler
    Replies: 16
    Last Post: 11-07-2010, 11:38 AM
  4. Replies: 5
    Last Post: 04-13-2010, 07:50 AM
  5. Replies: 7
    Last Post: 06-16-2008, 05:10 PM
  6. [SOLVED] check for alphabet in datalabel and then superscript that letter
    By Jyotsna in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-04-2005, 05:05 PM
  7. Replies: 2
    Last Post: 07-26-2005, 03:05 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