+ Reply to Thread
Results 1 to 8 of 8

Sumproduct with 1

  1. #1
    Forum Contributor
    Join Date
    08-25-2014
    Location
    Pennsylvania, US
    MS-Off Ver
    Windows '16
    Posts
    165

    Sumproduct with 1

    Is there a way to do a sumproduct of every item in a range with 1?

    =SUMPRODUCT(A1:A5,{1,1,1,1,1}) does not work for whatever reason. Neither does =SUMPRODUCT(A1:A5,1). Any way to do this without a helper column? Thanks

  2. #2
    Registered User
    Join Date
    01-08-2014
    Location
    Missouri
    MS-Off Ver
    365
    Posts
    87

    Re: Sumproduct with 1

    It does work, but the ranges you provide have to have compatible dimensions.

    A1:A5 is a vertical array of five values but {1,1,1,1,1} is a horizontal array of five values.

    Try this instead: =SUMPRODUCT(A1:A5,{1;1;1;1;1})
    Last edited by eibi; 03-08-2016 at 11:50 PM.

  3. #3
    Forum Contributor
    Join Date
    08-25-2014
    Location
    Pennsylvania, US
    MS-Off Ver
    Windows '16
    Posts
    165

    Re: Sumproduct with 1

    I knew there had to be a reason that wouldn't work. Thanks. Now is there any way to make that second example work? The dimension of the range is unknown and I don't want to have to type a ton of 1's in...

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Sumproduct with 1

    What exactly are you trying to do here?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    01-08-2014
    Location
    Missouri
    MS-Off Ver
    365
    Posts
    87

    Re: Sumproduct with 1

    When I need to return an array of 1's, I use something like this:

    =row($A$1:A5)^0

    I think you'll be able to produce the output you want like this:

    =SUMPRODUCT($A$1:A5,ROW($A$1:A5)^0)

    Entered as an array formula with Ctrl+Shift+Enter

    --------------------------------------

    Edited: CSE not needed -- see Khalidngo's correct observation, post #7, below.
    Last edited by eibi; 03-09-2016 at 12:23 PM.

  6. #6
    Forum Contributor
    Join Date
    08-25-2014
    Location
    Pennsylvania, US
    MS-Off Ver
    Windows '16
    Posts
    165

    Re: Sumproduct with 1

    Thanks ikeene +1 that's perfect

  7. #7
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: Sumproduct with 1

    Quote Originally Posted by ikeene View Post
    =SUMPRODUCT($A$1:A5,ROW($A$1:A5)^0)

    Entered as an array formula with Ctrl+Alt+Shift
    Hi ikeene,

    CSE not necessary here

    Blessing
    Khalid

  8. #8
    Registered User
    Join Date
    01-08-2014
    Location
    Missouri
    MS-Off Ver
    365
    Posts
    87

    Re: Sumproduct with 1

    Quote Originally Posted by Khalidngo View Post
    CSE not necessary here

    Blessing
    Funny -- I realized that too as I fell asleep last night...

    Good catch.

    Blessings to you too sir.
    Last edited by eibi; 03-09-2016 at 11:06 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Use sumproduct to further parse a sumproduct calculation
    By Araise in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-19-2015, 08:17 PM
  2. Count SUMPRODUCT Members / Average of SUMPRODUCT
    By Shingaru in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 03:59 PM
  3. Replies: 1
    Last Post: 05-19-2012, 02:54 AM
  4. Replies: 5
    Last Post: 04-20-2012, 08:54 AM
  5. Replies: 6
    Last Post: 03-09-2011, 08:01 AM
  6. Subtract Sumproduct from a sumproduct
    By Prcntrygrl in forum Excel General
    Replies: 6
    Last Post: 01-17-2011, 02:34 PM
  7. Using a SumProduct Count to find a SumProduct Total?
    By XL021710 in forum Excel General
    Replies: 3
    Last Post: 02-18-2010, 08:31 AM

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