+ Reply to Thread
Results 1 to 3 of 3

More elegant way to solve this...in Excel 2003?

  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    33

    More elegant way to solve this...in Excel 2003?

    A B

    1 50
    0 20
    1
    0 20
    1 5
    0

    I need to find the average of column B where A = 1 and B <> blank. Here's what I got:

    =SUMPRODUCT(--(A1:A6=1),(B1:B6))/SUMPRODUCT(--(A1:A6=1),--(B1:B6<>""))

    or

    =SUMIF(A1:A6,1,B1:B2)/SUMPRODUCT(--(A1:A6=1),--(B1:B6<>""))

    I feel like there's an shorter formula for this though...is there?

    Keep in mind I want to do this on Excel 2003, so no sumifs/countfs/averageifs.

    Thanks!

    EDIT - this seem to work too:

    =AVERAGE(IF(A1:A6=1,IF(B1:B6<>"",B1:B6,FALSE),FALSE))

    with CSE
    Last edited by XLOOKUP; 09-29-2013 at 11:35 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,311

    Re: More elegant way to solve this...in Excel 2003?

    And you can try:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Again, committed with Ctrl-Shift-Enter



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: More elegant way to solve this...in Excel 2003?

    The AVERAGEIF does not take into account blank cells anyways. So this should give you the desired results

    =AVERAGEIF(A1:A6,1,B1:B6)
    Life's a spreadsheet, Excel!
    Say thanks, Click *

+ 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] A more elegant way of using Multiple If???
    By Michael D in forum Excel General
    Replies: 8
    Last Post: 02-16-2013, 11:30 AM
  2. More elegant way to do IF ()
    By Barb Reinhardt in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-06-2006, 04:40 AM
  3. [SOLVED] More elegant method?
    By RoR in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-13-2006, 12:25 PM
  4. [SOLVED] How do I solve "too many different cell formats" in Excel 2003
    By Brettjg in forum Excel General
    Replies: 1
    Last Post: 12-12-2005, 11:15 AM
  5. [SOLVED] Second appeal for help-elegant way to do
    By Angol in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-23-2005, 11:05 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