+ Reply to Thread
Results 1 to 17 of 17

SUMPRODUCT unless row a certain colour

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    SUMPRODUCT unless row a certain colour

    Hi,

    Is it possible to use the below formula, but for it to not include rows that a certain colour?


    =SUMPRODUCT(--($H$2:$H$65536=2),--($Y$2:$Y$65536=7),$AA$2:$AA$65536)/100

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    Is the colour being set manually or by conditional formatting?
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: SUMPRODUCT unless row a certain colour

    Hi Judge it will be manually,

    Background: it is a file of test transactions, if there is a voided line in a transaction it will appear in say Y1 and Y2 with the same value, X1 will be a plus and X2 a minus. So would like to ignore these. But as they are two in rows SUMProduct cant account for this.

  4. #4
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    okay....that makes it a bit more difficult....if it was done using CF you could have incorporated the same logic in an IF statement that was used in the CF logic....somebody in this forum wrote a UDF that told you if a cell was coloured....so if you can find that, you can use it in an IF statement....IE: IF(Coloured, Do SUMPRODUCT, DoNothing)....let me know if you can't find it....maybe I can...

  5. #5
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: SUMPRODUCT unless row a certain colour

    I found this and added it in, can now see as a UDF

    Http://www.ozgrid.com/VBA/ReturnCellColor.htm

    not quite sure how to amend formula though.

  6. #6
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: SUMPRODUCT unless row a certain colour

    Think this may be better

    <Code>
    Function Filled(MyCell As Range)
    If MyCell.Interior.ColorIndex > 0 Then
    Result = 1
    Else
    Result = ""
    End If
    Filled = Result
    <\Code>

    End Function

  7. #7
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    by the way your [\code] should be [/code].....I did that the other day too....

  8. #8
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    looks a lot easier....do you need help on the formula to incorporate that with your SUMPRODUCT?

  9. #9
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: SUMPRODUCT unless row a certain colour

    Yeah, soon as I hit enter I realised that, spend most day looking at xml too :S

    Yes I wouldnt mind....

  10. #10
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    So I would change the function to return a 0 (that's a zero) instead of a ""....then try something like this...

    =IF(Filled(A1),SUMPRODUCT(),"")......in english....if the cell colour in A1 is anything but white do SUMPRODUCT else fill in the field with a blank (or anything else you want to the cell to display)...

  11. #11
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: SUMPRODUCT unless row a certain colour

    Sorry to keep on, but when I do this

    =IF(Filled(AA7),"yes","no") i get a yes if filled but if not i get #value! - any ideas?

  12. #12
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    wait....do you set the function return value for "" to a zero?

  13. #13
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    IE:

    Function Filled(MyCell As Range)
    If MyCell.Interior.ColorIndex > 0 Then
    Result = 1
    Else
    Result = 0
    End If
    Filled = Result

  14. #14
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    not without see the file...can you upload the file?

  15. #15
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Leicester
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: SUMPRODUCT unless row a certain colour

    Sorry, I have now, so that is all working great

    Just need to figure out how to combine with the SUMPRODUCT, missing out the rows that are coloured

  16. #16
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    sweeeeeeeeeeet.....glad it worked out....

  17. #17
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: SUMPRODUCT unless row a certain colour

    remember to set the thread/post to solved if this fixed your issue....

+ 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