+ Reply to Thread
Results 1 to 5 of 5

Sumproduct across several columns

  1. #1
    Registered User
    Join Date
    03-13-2010
    Location
    Bedfordshire, England
    MS-Off Ver
    Excel 2010
    Posts
    60

    Sumproduct across several columns

    I have the following code in a sheet, it looks at a range of cells and for those containing "READING" in Column BS it looks to Column CJ to see if its value is less than the value 1. The problem is that the word "READING" could be in one of 8 co


    Please Login or Register  to view this content.
    The problem is that the word "READING" could be in one of 8 columns. (BS to BZ)

    I've tried using the following code but it returns #VALUE! Has anybody got any idea how I can make this work.

    Please Login or Register  to view this content.
    Last edited by BobTheRocker; 01-26-2011 at 12:09 PM. Reason: Solved

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Sumproduct across several columns

    Perhaps:

    Please Login or Register  to view this content.
    The above assumes that should READING occur more than once per row you wish to count as 1 instance only - if not:

    Please Login or Register  to view this content.
    The 2nd is in essence an adaptation of your approach - note with Arrays of different dimensions (1x8 & 1x1) you must multiply the Arrays together as opposed to coercing each separately via double unary (#VALUE!)
    See the link in my sig. to Bob Phillips' white paper for more info. on SUMPRODUCT

  3. #3
    Registered User
    Join Date
    03-13-2010
    Location
    Bedfordshire, England
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: Sumproduct across several columns

    Thank you for your reply, I tried both but both returned zero when they should return 1. The first code you mentioned would be preferable as I would like to record several instances of reading as only 1 (though this is not essential).

    Please Login or Register  to view this content.
    this should return 1 when it matches the word READING in a column BS to BZ and in the corresponding row for column CJ it sees a blank.

    I tested it again using just one column (BS) and this works for one column but the word could appear in 1 of 8 columns.

    Please Login or Register  to view this content.
    Any ideas what I'm doing wrong?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Sumproduct across several columns

    You're not doing anything wrong - the example I gave you won't work - simple as ! Ooops.

    Please Login or Register  to view this content.
    obviously if you could create a single concatenation string on each row (aping above) then that would simplify the SUMPRODUCT

  5. #5
    Registered User
    Join Date
    03-13-2010
    Location
    Bedfordshire, England
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: Sumproduct across several columns

    Thanks very much for your help and how strange because just tried those formula with another example in a smaller worksheet and they work, so I tried them again in my main project and indeed both examples below work based on you coding.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    I will try your third example as well and see what that throws up. Thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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