logo elektroda
logo elektroda
X
logo elektroda

Excel - a formula that extracts a series of numbers from a series of digits

fafankulo 13491 9
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16497206
    fafankulo
    Level 11  
    Hello,

    I am looking for a solution to my problem in Excel with a series of digits generated by a code reader.
    For example, I have two series of numbers:

    (240) 60002626 (10) 170 161 256
    (240) 00683958 (10) 161 160 987

    I'm interested in pulling out the numbers after the brackets.

    for this series of numbers: (240) 60002626 (10) 170161256
    I'm using the formula:

    = TEXT FRAGMENT (D3; 4; 8) which gives me the result: 60002626

    later I repeat this formula to draw the second one from the numbers:

    = TEXT FRAGMENT (D3; 14; 9) with the result: 170161256

    and everything is OK.
    Until I do something like that with a string of numbers, e.g.

    (240) 00683958 (10) 161 160 987

    Here, too, I have to draw from this series of digits the numbers after (240) or 00683958, but I would like this number to not contain 00 if they appear in any number. So a good result would be if the record of this string were as follows:

    In one cell: 683958
    and in the second: 161160987


    Please help me which formula should I use.
    Thank you in advance and best regards
  • ADVERTISEMENT
  • Helpful post
    #2 16497247
    JRV
    VBA, Excel specialist
    = VALUE (MID (D3, 4, 8))
    it will be a number, not a text

    Added after 2 [minutes]:

    = TEXT (VALUE (TEXT FRAGMENT (D3, 4, 8)), "0") - will be the text
  • ADVERTISEMENT
  • Helpful post
    #3 16498584
    Prot
    Level 38  
    fafankulo wrote:
    Please help me which formula should I use.


    If you have such a regular structure of these codes, in my opinion, the formulas presented by a colleague JRV will suffice.

    In cases of non-uniform structures - you may be interested in "regular expressions" :D - https://www.elektroda.pl/rtvforum/topic3319015.html#16344661
  • #4 16500539
    fafankulo
    Level 11  
    Hello,
    At the beginning I thank Mr. JRV very much because what he gave was 100% successful.
    I have two more questions on the same subject, namely:

    1. how do I format a cell to display content in the form of a number of digits from the read bar code?
    I don't know why it displays this number of digits in one cell that is formatted as text, and in another cell, although it is formatted the same.
    2. How do I connect the function:
    = VLOOKUP (D28; [Book 2] Sheet1! A: B; 2; 0) So that I do not enter the values manually into cell D28 so far but it was
    taken from the cell that contains the formula:
    TEXT = (VALUE (MID (B13; 4; 8)); "0")

    I hope I wrote what I mean in an accessible and understandable way.
    I enclose printsreen excela maybe it will help what i mean.

    Thank you in advance for any help.
    Greetings.

    Excel - a formula that extracts a series of numbers from a series of digits
  • Helpful post
    #5 16500557
    JRV
    VBA, Excel specialist
    fafankulo wrote:
    that I do not enter the values manually so far into cell D28
    Judging from the fact that the value alignment edge in cells, in D28 it looks like a number then as in [Book2] Sheet1! A: And it looks like text, although it would actually be a number if the formula works
  • ADVERTISEMENT
  • Helpful post
    #6 16501858
    lanzul
    Level 30  
    fafankulo wrote:
    ... 1. how do I format a cell so that it displays content in the form of a read bar code in the form of a series of digits.
    I don't know why it displays this number of digits in one cell that is formatted as text, and in another cell, although it is formatted the same.

    2. How do I connect the function ... So that I do not enter the value manually into cell D28, but it was there?
    taken from a cell that contains ... formulas ...

    Ad 1
    Format the column into which the codes from the scanner are read on text values . but before scanning codes - Excel has display accuracy of 15 digits, and here are 22 digits.

    Ad 2
    JRV wrote:
    ... Judging from the fact that the edge of value alignment in cells, in D28 it looks like a number then as in [Book2] Sheet1! A: And it looks like text, although it would actually be a number if the formula works

    Just ... a friend JRV he rightly noticed ... how the search formula should work correctly since in "Sheet1" the value in D28 is in the form of a number , and in "Sheet1 of Book 2" the corresponding values in the form of text ?
    ... you have to decide on something ... either text or number ...
    ... or here text, there number, but search function with text-number conversion function ... or number-text ...
  • #7 16502251
    fafankulo
    Level 11  
    Hello,

    Thank you for your answers.
    Although I have to admit I didn't understand much.
    That is why I decided to present again what I mean:
    I attach a screen in jpeg and two sheets in Excel.

    Thank you in advance, and I'm sorry that I'm so crude.
    Greetings, ;-)
  • ADVERTISEMENT
  • Helpful post
    #8 16502266
    JRV
    VBA, Excel specialist
    fafankulo wrote:
    and two sheets in Excel.
    It should be from the very beginning.
    Values in Book 2, column A: A is numbers (all cells are formatted as: general), but .... the alignment takes place on the left edge, then it has look text.
    Simply use H = VALUE (TEXT FRAGMENT (B13; 4; 8)) in H13
    As for B5 - the same format general , left edge alignment
  • Helpful post
    #9 16503907
    lanzul
    Level 30  
    In addition, since a colleague is to use this sheet to identify goods by scanning their bar codes, you can also add the " hyperlink ", which will display to a colleague a photo of the scanned product, for comparison of the correctness of the data. Function record, description of the rest and 'configuration' scheme of access to photos of goods in the attached zip archive (photo names should be the same as the goods codes):
    Skaner-B..a.zip Download (76.74 kB)
  • #10 16505908
    fafankulo
    Level 11  
    Hello,

    I would like to thank everyone who tried to help me with my problem, in particular Mr. JRV because by following his advice I managed to get the effect I wanted.

    Again thank you very much.
    Greetings.

Topic summary

The discussion revolves around extracting specific numbers from a series of digits in Excel, particularly after brackets in a code generated by a scanner. The user initially employs the formula =TEXT FRAGMENT(D3; 4; 8) to extract numbers but encounters issues when needing to remove leading zeros from certain values. Various solutions are proposed, including using the VALUE and MID functions to convert text to numbers and formatting cells correctly to ensure proper data alignment. The importance of consistent data formatting (text vs. number) is emphasized for functions like VLOOKUP to work effectively. The user expresses gratitude for the assistance received and confirms successful implementation of the suggested solutions.
Summary generated by the language model.
ADVERTISEMENT