+ Reply to Thread
Results 1 to 9 of 9

problem sumproduct ?

  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
    2016
    Posts
    14,675
    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
    2016
    Posts
    14,675
    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.

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

    Question

    Dear both,

    Thanks for your help
    according to me, my formula as below

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

    It works, but it returns as countif function, i wanna return sumifs function

    how to fix it ?

    Thanks agian

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    As I said in my last post....

    That's difficult because you can't easily derive the number from an entry like "A3" without getting an error because you are also trying to derive a number from "AC".

    A formula like Mike's would work using SUMPRODUCT but as it also needs CSE I presume that would negate the advantage of SUMPRODUCT for you?

    What is the extent of the values in F40:AJ40, you say you can have "AB", "AC", "A2" and "A8", how many other combinations are there? If there are a limited number then you could probably use a non-CSE formula to do what you want.

    Ultimately the best advice for you, I think, would be to consider redesigning your spreadsheet. Clearly the setup you have means using complex formulas that are harder to debug and maintain. A simpler setup, perhaps having the numbers in a separate range to the letters, would allow you to employ simpler, more easily adaptable formulas.

  9. #9
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135
    Thanks for you advice, i successfully used the sum function combine ctrl - shift enter already, but i wanna find the second formula

    Thank you agian

+ 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