View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.newusers
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Using formulas in conditions (SUMIF, AVERAGEIF)

For the sum if, try this:

=SUMPRODUCT(--(A1:A10=10),--(A1:A10<=20),A1:A10)

For the average if is odd, try this array formula** :

=AVERAGE(IF(MOD(A1:A10,2),A1:A10))

The ISODD/ISEVEN functions won't work on arrays. Also, I'm assuming the
values in question are integers and there are no text entries in the range.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

If you're using Excel 2007 there is an AVERAGEIF function but I don't use
Excel 2007 so I don't know the correct syntax. The above array formula will
work in any version.

--
Biff
Microsoft Excel MVP


"Jan Kucera" wrote in message
...
Hi,
I want to use formula in condition syntax, but I don't know how to
reference the value being tested.

Like:
SUMIF(A1:A10;"10 AND <20")

Or:
AVERAGEIF(A1:A10;"ISODD(...)")

Thanks for any ideas.

Jan



 
ExcelBanter Database Error
Database Error Database error
The ExcelBanter database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.excelbanter.com home page, then try to open another page.
  • Click the Back button to try another link.
The www.excelbanter.com forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.