+ Reply to Thread
Results 1 to 9 of 9

problem sumproduct ?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    Question problem sumproduct ?

    dear all,

    i successfully did with {=sum(if...)}

    i now wanna the same result with sumproduct, but result is zero

    =SUMPRODUCT(--(NOT(TEXT($F$7:$AJ$7,"ddd")="SUN"))*(LEFT((F40:AJ40),1)="A"),RIGHT(F40:AJ40)) -> result is 0

    =SUMPRODUCT(--(NOT(TEXT($F$7:$AJ$7,"ddd")="SUN"))*(LEFT((F40:AJ40),1)="A"),value(RIGHT(F40:AJ40))) --> result is #value

    thanks for your help,
    vumian
    Last edited by vumian; 02-15-2008 at 12:16 PM.

  2. #2
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    Hi

    Not sure exactly what you are trying to achieve but SUMPRODUCT requires all ranges to be the same size.

    Why not post a sample and a description of what you want to achieve?

    Ed

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,703
    Hello vumian,

    What sort of values do you have in F40:AJ40? Presumably a letter followed by a single digit, e.g. A3?

    If so then I imagine that your second formula will work if there are no blanks in the range but it will fail if there are blanks (in F40:AJ40) or if that range contains data where the rightmost character is not a number.

    To accommodate blanks perhaps try

    =SUMPRODUCT(--(WEEKDAY($F$7:$AJ$7)<>1)*(LEFT(F40:AJ40)="A"), RIGHT(0&F40:AJ40)+0)
    Last edited by daddylonglegs; 02-15-2008 at 01:07 PM.

  4. #4
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    Question

    hi Daddylonglegs,

    Thanks for your formula, but it does not work , return #value
    F40:AJ40 have Text only (eg : AB or AC), Text and number (eg : A2 or A8), and Blank

    Thanks for your help again

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,703
    No, if you have entries like "AC" that formula won't work, presumably if you have "AC" on a non-Sunday it should count as zero?

    It's difficult to do with SUMPRODUCT because you need to coerce the RIGHT function to numeric...but if you do that where the cell contains text you get an error.

    Why not stick with SUM(IF....?

    You could perhaps use

    =SUM(IF((WEEKDAY($F$7:$AJ$7)<>1),IF(ISNUMBER( SUBSTITUTE(F40:AJ40,"A",0)+0),SUBSTITUTE(F40:AJ40,"A",0)+0)))

    confirmed with CTRL+SHIFT+ENTER

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    how about

    =SUMPRODUCT(--(NOT(TEXT($F$7:$AJ$7,"ddd")="SUN"))*(LEFT((F40:AJ4 0),1)="A"), IF(ISNUMBER(VALUE(RIGHT(F40:AJ40)),VALUE(RIGHT(F40:AJ40)),0))
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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