+ Reply to Thread
Results 1 to 8 of 8

Numeric values from text

  1. #1
    Forum Contributor
    Join Date
    07-21-2021
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003, 2007, 2013, 2019
    Posts
    215

    Numeric values from text

    For some years, I have played with extracting numeric values from text. The following is an image of the report of the findings.
    NumbersFromText.png

    Column B shows the number of number groups the code has identified. Colmns C and D report on the value of the 1st and 2nd number groups respectively.

    You will note that the yellow highlighted cells contain superscript values. However these have not been identified, accordingly the number group values in column B are imcorrect.

    The primary numeric extraction is below.

    Please Login or Register  to view this content.
    I would be grateful for advice on how to identify Superscript and Subscript indices and code for them. Are there any other numeric related printing elements that I should also take into account?
    Last edited by swaatacba; 09-24-2023 at 06:35 AM.
    Regards,

    Stephen

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,528

    Re: Numeric values from text

    Not entirely sure how you would incorporate this into your code, but this tests strings for characters that have strikethrough and/or, subscript or superscript.

    Please Login or Register  to view this content.
    PHP Code: 
    Debug Output
    t             str
    False    subFalse    supFalse
    e             str
    False    subFalse    supFalse
    x             str
    False    subFalse    supFalse
    t             str
    False    subFalse    supFalse
                  str
    False    subFalse    supFalse
    b             str
    True     subFalse    supFalse
    e             str
    False    subFalse    supFalse
    f             str
    False    subFalse    supTrue
    o             str
    False    subFalse    supFalse
    r             str
    False    subTrue     supFalse
    e             str
    False    subFalse    supFalse
                  str
    False    subFalse    supFalse
    1             str
    False    subFalse    supFalse
    2             str
    False    subFalse    supFalse
    3             str
    True     subFalse    supFalse
    4             str
    False    subFalse    supFalse
    5             str
    False    subFalse    supTrue
    6             str
    False    subFalse    supFalse
    7             str
    False    subTrue     supFalse
    8             str
    False    subFalse    supFalse
    9             str
    True     subFalse    supTrue
                  str
    False    subFalse    supFalse
    t             str
    False    subFalse    supFalse
    e             str
    False    subFalse    supFalse
    x             str
    False    subFalse    supFalse
    t             str
    False    subFalse    supFalse
                  str
    False    subFalse    supFalse
    a             str
    True     subFalse    supTrue
    f             str
    False    subFalse    supFalse
    t             str
    False    subFalse    supFalse
    e             str
    True     subTrue     supFalse
    r             str
    False    subFalse    supFalse 
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,569

    Re: Numeric values from text

    swaatacba,

    try
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-21-2021
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003, 2007, 2013, 2019
    Posts
    215

    Re: Numeric values from text

    Thank you, Trevor.

    I agree that Strikethrough, Superscript and Subscript are the most obvious candidates.

    I had hoped to include "overline" for 0.333 ... recurring etc. So far, I have been unsuccessful.

    The longer term aim is to identify the script value with a number. For example Normal = 0, Strikethrough = 1, Superscript = 2.
    But what about Subscript, should it be 3 or 4? The latter would allow a combination of strikethrough and superscript as 1 + 2 = 3. Thus leaving Subscript as 4,
    We could slso a combination Strikethourgh and Subscript as 1 + 4 = 5. Curiously, that would leave a combination of Superscript and Subscript as 2 + 4 = 6. But that does not make practical sense.

    I attach a workbook where I have been exploring these issues.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    07-21-2021
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003, 2007, 2013, 2019
    Posts
    215

    Re: Numeric values from text

    Quote Originally Posted by jindon View Post
    swaatacba, try
    Thank you. I have tried your code but it does not deliver the results I need.

    Also, I confess, that I do not understand the code fully. That would normally prejudice me against using it.
    Last edited by swaatacba; 09-24-2023 at 09:33 AM.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,528

    Re: Numeric values from text

    It must be Normal=0, Strikethrough=1, Subscript=2, and Superscript=4. They are all formatting. I would guess that overline would be a separate character set.

    See updated example.

  7. #7
    Forum Contributor
    Join Date
    07-21-2021
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003, 2007, 2013, 2019
    Posts
    215

    Re: Numeric values from text

    Thank you, that was useful. I also noted an error in my original code, which is also helpful.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,528

    Re: Numeric values from text

    You're welcome. Thanks for the rep.



    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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] VLOOKUP alpha numeric text against source file numeric values.
    By pbloem@btintern in forum Office 365
    Replies: 6
    Last Post: 06-30-2021, 09:13 AM
  2. Applying Formula to assign numeric values to text values in sequential order
    By jmshanahan in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-15-2016, 03:04 PM
  3. look up text, or numeric values
    By techiemom60 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-02-2016, 03:36 PM
  4. Convert Text Values to Specific Numeric Values
    By lmp101010 in forum Excel General
    Replies: 5
    Last Post: 09-06-2014, 04:00 PM
  5. [SOLVED] Trim values as numeric not as text
    By werko in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-25-2014, 02:41 AM
  6. [SOLVED] vba macros to force user to input numeric values for numeric values with hyphen
    By Abdur_rahman in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-28-2013, 01:05 PM
  7. [SOLVED] UDF to Vlookup multiple delimited values (numeric/non-numeric) and sum found values
    By Geert Rottiers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2013, 09:30 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