+ Reply to Thread
Results 1 to 8 of 8

Search cell that contains multiple numbers and text and pull out only the negative number

  1. #1
    Registered User
    Join Date
    01-05-2016
    Location
    Tucson
    MS-Off Ver
    Office 365
    Posts
    3

    Search cell that contains multiple numbers and text and pull out only the negative number

    I have a report that runs automatically from a point of sale system which automatically provides a .pdf which I then in turn copy and paste into Excel for easier manipulation. The problem is that when pasted, it automatically places all the information in cell A. I need to be able to extract just the last number from this cell, which is always a negative number (dollar amount), and place it in a separate cell for easier reporting. I used the following formula, in Column D, to extract the needed text from cell A1, =IF(ISNUMBER(SEARCH("text",A1)),"text".

    What I need to do now is extract just the last number in that cell which is negative. I could use the same formula, but would have to repeat it hundreds or thousands of times with the increasing dollar amounts in order for this to work. I would need for B1 to display 7.48, B2 to display 21.00, and so forth in this example. Is this possible?
    Attached Files Attached Files

  2. #2
    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,192

    Re: Search cell that contains multiple numbers and text and pull out only the negative num

    Try

    =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))+0

    Copy down

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Search cell that contains multiple numbers and text and pull out only the negative num

    You could put this in B1:

    =--RIGHT(A1,8)

    then copy down.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    01-05-2016
    Location
    Tucson
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Search cell that contains multiple numbers and text and pull out only the negative num

    Awesome! Both suggestions worked. Is it possible to have the number that appears be positive? I tried formatting the cells and using the second option down but then it will only display the number in red. If not, no worries this was a huge help!

  5. #5
    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,192

    Re: Search cell that contains multiple numbers and text and pull out only the negative num

    =trim(right(substitute(a1," ",rept(" ",99)),99))*-1

  6. #6
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Search cell that contains multiple numbers and text and pull out only the negative num

    use

    =RIGHT(A1,8)*-1

    or to always return positive values

    =ABS(RIGHT(A1,8))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  7. #7
    Registered User
    Join Date
    01-05-2016
    Location
    Tucson
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Search cell that contains multiple numbers and text and pull out only the negative num

    That did the trick! Thanks so much, I really appreciate the help!

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Search cell that contains multiple numbers and text and pull out only the negative num

    Quote Originally Posted by frenchrich504 View Post
    Is it possible to have the number that appears be positive?
    Like this...

    =-RIGHT(A1,8)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Pull just Number data from cell with numbers and text
    By snuffnchess in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-27-2015, 08:07 PM
  2. [SOLVED] SUMIF positive and negative numbers - take double a negative number?
    By Zordrail in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-16-2014, 08:34 AM
  3. Code/Solution To Search All Text in a Cell and Pull UniqueID Corresponding to the Text
    By brandnew22 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-06-2013, 10:56 AM
  4. Replies: 2
    Last Post: 12-19-2012, 08:12 PM
  5. [SOLVED] VBA to search number/text and pull information from access into excel
    By stephen11 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-24-2012, 08:44 AM
  6. Replies: 1
    Last Post: 11-20-2008, 01:52 AM
  7. Formula to pull negative number
    By atomlins in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-23-2008, 04:39 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