+ Reply to Thread
Results 1 to 4 of 4

Using SUMPRODUCT to Extract #'s from mid String including Zero's

  1. #1
    Valued Forum Contributor
    Join Date
    04-26-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    502

    Using SUMPRODUCT to Extract #'s from mid String including Zero's

    Afternoon Guys,

    I am using the excellent SUMPRODUCT formula below to extract numbers from a scoreline provided by Web Query.
    =SUMPRODUCT(MID(0&$AD$212, LARGE(INDEX(ISNUMBER(--MID($AD$212, ROW(INDIRECT("1:"&LEN($AD$212))), 1)) * ROW(INDIRECT("1:"&LEN($AD$212))), 0), ROW(INDIRECT("1:"&LEN($AD$212))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN($AD$212)))/10)

    The final match results come in using this format: 'Liverpool 4 - 0 FC Barcelona' in a text string, the above formula returns the result 40 which works fine when I use the LEFT or RIGHT Function afterwards to extract the numbers. During testing however, if the result was reversed 'Liverpool 0 - 4 FC Barcelona' the formula returns a 4 without the leading zero making it impossible to determine the match winner.

    So my question is, could the formula be modified to include leading zero's or is there a good work around that I haven't thought of ?

    I tested this earlier btw
    =MID(AD220,LOOKUP(10^99,--SEARCH(ROW(INDIRECT("1:900000")),AD220)),6) but run into the same problem 1st score is correct the reversed score is incorrect.

    The test sheet supplied shows both correct and incorrect results.

    Thanks in Advance.
    Attached Files Attached Files
    Last edited by BlindAlley; 05-09-2019 at 12:51 PM.
    Uploading an attachment will assist Forum Members in finding the correct Solution for you. Create a dummy worksheet if necessary, add your start data and show where / what your expected results should be. TO ADD A FILE:

    Go to 'Advanced. click on 'Manage Attachments. Select 'Browse & Choose your file, Select 'Upload and then close the Attachment window.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Using SUMPRODUCT to Extract #'s from mid String including Zero's

    Seems like more work than is necessay.
    Using your posted workbook, I think these regular formulas do what you want:
    Please Login or Register  to view this content.
    Also, your winner calculation formula doesn't test for tie scores...
    Maybe this?
    Please Login or Register  to view this content.
    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Valued Forum Contributor
    Join Date
    04-26-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    502

    Re: Using SUMPRODUCT to Extract #'s from mid String including Zero's

    Thanks Ron,

    Let me test those out and get back to you.

    As for the 2nd formula there are no ties in the Champions league during the 2nd leg, they use the away goals count double, extra time, and penalties to negate a tie.

  4. #4
    Valued Forum Contributor
    Join Date
    04-26-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    502

    Re: Using SUMPRODUCT to Extract #'s from mid String including Zero's

    Excellent - Works for me Ron thank you.
    I've been scratching my head on this problem for two days and now it is fixed.

    Thanks again
    Steve

+ 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] SUMPRODUCT ERROR when including non data row
    By drgkt in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-08-2017, 11:29 PM
  2. [SOLVED] Help with sumproduct/sumif including blank cells
    By cjgillma in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-27-2015, 12:19 AM
  3. SUMPRODUCT including empty cells :(
    By dazbear in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-22-2014, 11:28 AM
  4. Replies: 7
    Last Post: 07-25-2014, 08:21 AM
  5. [SOLVED] SUMPRODUCT/COUNTIFS With 3 Variables Including 1 Date
    By Bellio3105 in forum Excel General
    Replies: 4
    Last Post: 10-04-2012, 05:42 PM
  6. Excel 2007 : Sumproduct is including blanks
    By ahmedmido in forum Excel General
    Replies: 3
    Last Post: 11-16-2010, 03:08 PM
  7. Extract first name including fixed text
    By holiday4ever in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-06-2008, 10:24 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