+ Reply to Thread
Results 1 to 9 of 9

Pulling number values from text string

  1. #1
    Registered User
    Join Date
    02-02-2022
    Location
    Hill AFB, Utah
    MS-Off Ver
    2019 Pro
    Posts
    3

    Pulling number values from text string

    Hello all,

    It's been a very long time since I've posted here (old account won't let me log in, so I had to create this new one)

    Anyways, I'm trying to help my wife by making an automated spread sheet for her job. Shes a GM at our local bar and at the end of every night she needs to fill out her paperwork and reconcile the numbers for the day. Each set of paperwork per day needs to have a top sheet that has the important number listed for easy viewing. for years we have had to manually write these down after looking through long receipt printouts. After figuring out how to pull the same info up on her computer, I need a formula that will automatically search a second worksheet for a key word(s) and then pull the number value from the text string.

    I found a helpful website that gave me the following formula:
    =RIGHT(A2, LEN(A2) - MAX(IF(ISNUMBER(MID(A2, ROW(INDIRECT("1:"&LEN(A2))), 1) *1)=FALSE, ROW(INDIRECT("1:"&LEN(A2))), 0)))

    Obviously I replace the value A2 with the cell in the separate sheet. This has gotten me the closest to what I need except that it also includes the multiple "." before the numbers (eg. " Cash Payments ................. 492.25" shows as "................. 492.25" and not "492.25").

    The next problem I found is that occasionally if it was a busy night, there may be more people bar tending that logged into the point of sale system causing the information to have more cells than other days. So the formula above wont work with the cell that I reference.

    Here is a small sample of the information it needs to comb through:
    ==========================================
    Cash Reconciliation
    ==========================================

    Open Cash .......................... 0.00
    +Total Cash ....................... 492.25
    Cash Payments ................. 492.25
    +Cash Pay Ins .................... 0.00
    -Cash Pay Outs ................... 0.00
    -Gift Card Cashouts .............. 0.00
    -Total Tips ....................... 243.00
    Auto Gratuity ................... 0.00
    +Non-Cash Tips ................. 243.00
    =Cash Due ......................... 249.25
    -Close Cash ......................... 0.00
    =Over/Short ....................... 249.25

    Total Cash Due 249.25

    Out of this sample, I would need the values for "Cash Payments", "Total Tips", and "Cash Due". Any help on this will be GREATLY appreciated, and it will help my wife to get her paperwork done quicker and home sooner every night.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,182

    Re: Pulling number values from text string

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Pulling number values from text string

    if we assume the receipt data is in sheet2, column A, and you have Cash Payments, Total Tips and Cash Due in Cells A2:A4 on Sheet1 then:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    would return 492.25, 243.00, and 249.25, respectively.

  4. #4
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Pulling number values from text string

    Another solution, if your data is in A1

    =IFERROR(VALUE(RIGHT(SUBSTITUTE(A1," ",REPT(" ",10)),10)),"")

    Regards.

  5. #5
    Registered User
    Join Date
    02-02-2022
    Location
    Hill AFB, Utah
    MS-Off Ver
    2019 Pro
    Posts
    3

    Re: Pulling number values from text string

    Thank you for the replies.
    I tried to enter the formulas you provided me into my product, but I didn't get the result I was needing or it didn't work at all. I cleaned up sensitive
    (non important info) and have attached the excel file. Sheet1 is the "cover sheet" that will be printed out and Sheet2 has all the info from the day's stats.
    I've added two additional tabs labeled "Target Info" and "Info Required" (clones of Sheet1 and 2), I color coded the blocks on these extra sheets to show where
    the info needs to be pulled from. Keep in mind that the cells that the info is currently in can change from day to day (So A25 in sheet "Info Required" could
    end up being in A58 then next day). However the info will always be in the same order and layout everyday. The info I deleted (eg. Names of the employees logged
    in that day) will be entered in above what is currently listed on Sheet2 ("Info Required").

    I hope this will help clarify what I am needing.

    Thank you again for any help you can provide.
    Attached Files Attached Files

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,182

    Re: Pulling number values from text string

    I presume that the data that you receive always has the same nomenclature. Therefore, if you set a formula for each value you want, like the one below, it will always find the correct data.

    For example, for Net Amounts:

    =--TRIM(RIGHT(SUBSTITUTE(VLOOKUP("Net Receipts"&"*",'Info Required'!$A$1:$A$180,1,0),"$",REPT(" ",99)),20))

    and for Taxes:

    =--TRIM(RIGHT(SUBSTITUTE(VLOOKUP("Included Taxes"&"*",'Info Required'!$A$1:$A$180,1,0),"$",REPT(" ",99)),20))

  7. #7
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Pulling number values from text string

    I would suggest, per attached, that you store each appropriate search term in Col A (white font if necessary, so invisible -- red in sample so you can see); and use a common formula in X (akin to post#2) for each cell
    the exception would be Food given this will store % last, rather than amount -- so slightly different formula here
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-02-2022
    Location
    Hill AFB, Utah
    MS-Off Ver
    2019 Pro
    Posts
    3

    Re: Pulling number values from text string

    First of all, Thank you AliGW and XLent for you replies and all your help. AliGW, your formulas you posted worked great for those two examples. However, I was having issues with them when I tried applying them to the other fields (most likely an error on my part lol). XLent, the file you posted worked perfectly! Unfortunately I discovered an issue I wasn't aware of initially. While trying your example with other days info, I kept getting the error of #VALUE. Come to find out the number "70" you had put in for the search criteria is subjective to each day. I wasn't aware that the 70 was total from the lines above it for the different types of payments made.

    As you can see below, the info from another day totaled 105:

    Qty Type Amount Tip Total
    ---- ----------- -------- ------- --------
    3 Amex 103.25 40.00 143.25
    33 Cash 397.75 0.00 397.75
    1 Discover 43.75 9.00 52.75
    1 Gift Card 27.50 0.00 27.50
    4 Mastercard 36.75 8.50 45.25
    63 Visa 1419.50 353.00 1772.50
    ---- ----------- -------- ------- --------
    105 2028.50 410.50 2439.00
    Tot. CCs w/ Tips 2013.75
    Tot. CC Paid In/Out 0.00
    Tot. CCs w/ Tips Plus Paid In/Out 2013.75

    Would you have any ideas on how to compensate for this? Once again the row this info (105 2028.50 410.50 2439.00) is on may be different day to day.

    Thank you again for all your help. My wife is really excited about this making her workload a lot easier.

  9. #9
    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
    30,671

    Re: Pulling number values from text string

    Try

    in A20

    Tot. CCs w/ Tips

    This text appears to be one row below the data you need so using the formula below, we match the A20 data and return the line above by subtracting 1 from the matched row

    in X20

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


    And all those merged cells - pretty but not very practical - and should be avoided like the plague!!!!
    Attached Files Attached Files
    Last edited by JohnTopley; 02-06-2022 at 08:22 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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] Pulling certain criteria from a string of text and match to a pallet number
    By pmw19800 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-26-2021, 02:21 PM
  2. Pulling text and date out of a long string of text
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2019, 01:03 PM
  3. [SOLVED] Pulling Number from Text String
    By sbeatty in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-03-2017, 12:51 PM
  4. [SOLVED] pulling out 12 digit number from an alphanumeric string
    By susan doyle in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-19-2013, 08:49 AM
  5. [SOLVED] Pulling a string of text
    By Montoro22 in forum Excel General
    Replies: 5
    Last Post: 06-11-2013, 11:36 AM
  6. Replace various number values in cells with a text string
    By tommygray in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2013, 05:35 AM
  7. Pulling only the number out of a string
    By bconner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2008, 03:32 PM

Tags for this Thread

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