+ Reply to Thread
Results 1 to 9 of 9

SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cells

  1. #1
    Registered User
    Join Date
    11-22-2012
    Location
    Rome, Italy
    MS-Off Ver
    Excel 2003
    Posts
    4

    SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cells

    Kind all,

    I'm getting crazy with this issue any help will be appreciated!

    I've two columns: on M text descriptions, on I values. I need to SUM values only if it find a 16 characters number (ex. 4001098776554332) but must starting with "4" as first character in M range.

    Some unlucky test: SUMPRODUCT((LEN('SQL Results'.M2:M65536=16))*(LEFT('SQL Results'.M2:M65536,1)="4"),('SQL Results'.I2:I65536) ...and many other unsuccessful variants.
    I also tried with SUMIF('SQL Results'.M2:M65536;"^4...............";'SQL Results'.I2:I65536) using regular expression in OpenOffice. Seems function, but I prefer to do it with SUMPROD. This can sounds good in your experience?

    I try to find also the number (not the SUM) using SUMPRODUCT(--(LEN('SQL Results'.M2:M65536)=16))...but it's not correct, because it count also letters and space (this formula return the count of 16 characters cells only, but i need 16 numbers starting with 4 as very first cell character.

    Thank you for your kind collaboration.

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

    Re: SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cel

    In Excel you need to separate the sheet name from the cell references with !, so your first formula would be:

    =SUMPRODUCT((LEN('SQL Results'!M2:M65536)=16)*(LEFT('SQL Results'!M2:M65536)="4"),('SQL Results'!I2:I65536))

    and if you wanted to omit cells with spaces:

    =SUMPRODUCT((LEN('SQL Results'!M2:M65536)=16)*(LEFT('SQL Results'!M2:M65536)="4")*(ISNA(SEARCH(" ",M2:M65536))),('SQL Results'!I2:I65536))

    If you want to count them, then do this:

    =SUMPRODUCT((LEN('SQL Results'!M2:M65536)=16)*(LEFT('SQL Results'!M2:M65536)="4")*(ISNA(SEARCH(" ",M2:M65536))))

    Do you really need to have such long ranges?

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    11-22-2012
    Location
    Rome, Italy
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cel

    Thank you for your quick replay Pete, I know the ! quotation in Excel, but in OpenOffice is different. Anyway with ! or . I still receive the same "bracket error".

    And yes, unfortunately data fill the entire range

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

    Re: SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cel

    Check where I've put my brackets - you had them in the wrong place for the LEN expression.

    Pete

  5. #5
    Registered User
    Join Date
    11-22-2012
    Location
    Rome, Italy
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cel

    A little step haed! Thank you, but still have error bracket with this formula...SUMPRODUCT((LEN('SQL Results'.M2:M65536)=16)*(LEFT('SQL Results'.M2:M65536)="4"),('SQL Results'.I2:I65536))

    Any idea?

  6. #6
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cel

    Edit
    Did not notice the different program
    Last edited by dredwolf; 11-22-2012 at 02:05 PM.
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cel

    Try in Calc (Open Office)
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  8. #8
    Registered User
    Join Date
    11-22-2012
    Location
    Rome, Italy
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cel

    Marcol, you are a legend! Thank you!

    The problem was (as you highlighted) ";" instead of "," not brackets! And it's return the same value of =SUMIF($'SQL Results'.M2:M65536;"^4...............";$'SQL Results'.I2:I65536)

    Excel-lent best forum ever!

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

    Re: SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cel

    Just remember, though, that this is a forum for Excel, not Open Office Calc or Google Docs ...

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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