+ Reply to Thread
Results 1 to 6 of 6

SUMIF in discontinuous range with possible #N/As

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    SUMIF in discontinuous range with possible #N/As

    Hi, I have two related questions.

    First, I would like to do a sum function but with cells that are not next to each other and may sometimes be #N/A. See below:

    =SUMIF((A1,C1,E1),"<>#N/A")

    Unfortunately this only seems to work if the range is continuous, such as when it is (A1:E1). Any suggestions?

    Second, I'm doing something similar but with an vlookup array. See below:

    {=SUMIF(VLOOKUP($A$1,A1:AZ8,{5,14,23,32},FALSE),"<>#N/A"}

    This also doesn't work. Any recommendations?

    Thank you!

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: SUMIF in discontinuous range with possible #N/As

    try this array entered formula
    =SUMPRODUCT(--(MOD(COLUMN(A1:E1),2)=1),IF(ISNA(A1:E1),0,A1:E1))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Re: SUMIF in discontinuous range with possible #N/As

    Quote Originally Posted by martindwilson View Post
    try this array entered formula
    =SUMPRODUCT(--(MOD(COLUMN(A1:E1),2)=1),IF(ISNA(A1:E1),0,A1:E1))
    Thanks. What does the "--" do that's in front of MOD?

  4. #4
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: SUMIF in discontinuous range with possible #N/As

    Quote Originally Posted by lesoies View Post
    Thanks. What does the "--" do that's in front of MOD?
    Look at his signature!

  5. #5
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: SUMIF in discontinuous range with possible #N/As

    You could use

    Formula: copy to clipboard
    =SUM(IF(ISNUMBER(N(OFFSET(A1,0,{0;2;4}))),N(OFFSET(A1,0,{0;2;4}))))

  6. #6
    Forum Contributor
    Join Date
    07-17-2012
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    218

    Re: SUMIF in discontinuous range with possible #N/As

    Quote Originally Posted by Bob Phillips View Post
    You could use

    Formula: copy to clipboard
    =SUM(IF(ISNUMBER(N(OFFSET(A1,0,{0;2;4}))),N(OFFSET(A1,0,{0;2;4}))))
    Thanks. This works well. Out of curiosity, why is N() necessary, for example in front of the offset? As I understand it, N just returns the number if it is a number, and the error if it is an error, so why not go directly with ISNUMBER(OFFSET ? I tried it and it didn't work, so it seems N() is necessary, but for what reason? Is it because due to programming limitations it needs to somehow "convert" from the array created by OFFSET?

+ 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