You are here:

# Excel/Array

Question
QUESTION: I have an averageifs function I'd like to pair with effectively a "Maxifs," "Minifs" and "medianifs" funciton.  I know I need to turn it into an array function, but don't know how to.  Apologies for how disgusting this formula looks...

=IFERROR(AVERAGEIFS('PE-VC Transactions'!\$I:\$I,'PE-VC Transactions'!\$K:\$K,Financings!\$B\$3,'PE-VC Transactions'!\$L:\$L,Financings!O\$3),"NMF")

Is it easily done?

Thanks!

You can build your conditional array with:

if(('PE-VC Transactions'!\$K:\$K=Financings!\$B\$3)*('PE-VC Transactions'!\$L:\$L=Financings!O\$3),'PE-VC Transactions'!\$I:\$I)

so

=IFERROR(MAX(IF(('PE-VC Transactions'!\$K:\$K=Financings!\$B\$3)*('PE-VC Transactions'!\$L:\$L=Financings!\$O\$3),'PE-VC Transactions'!\$I:\$I)),"NMF")
entered with Ctrl+shift+Enter rather than just enter since this is an array formula

=IFERROR(MIN(IF(('PE-VC Transactions'!\$K:\$K=Financings!\$B\$3)*('PE-VC Transactions'!\$L:\$L=Financings!\$O\$3),'PE-VC Transactions'!\$I:\$I)),"NMF")

entered with Ctrl+shift+Enter rather than just enter since this is an array formula

Median isn't going to work.

--
Regards,
Tom Ogilvy

---------- FOLLOW-UP ----------

QUESTION: Thanks, worked perfectly.  I tried to steal your work to put into a slightly different array, and had some issues.  Do you see anything in this formula which would make it not work?

=IFERROR(MAX(IF(('M&A Database'!\$S:\$S=O\$3)*('M&A Database'!\$N:\$N='M&A'!\$B\$3)*('M&A Database'!\$I:\$I<1000),'M&A Database'!\$P:\$P)),"NMF")

Also, in general, to add additional conditions to the array, can I simply add "*([range]=[condition])" to the formula, and ctr + shift + enter and I'm there?

Thanks again

Bill,

In you second condition you have 'M&A'!\$B\$3   If you follow pattern, that should be just \$B\$3.

this worked for me:

=IFERROR(MAX(IF(('M&A Database'!\$S:\$S=O\$3)*('M&A Database'!\$N:\$N=\$B\$3)*('M&A Database'!\$I:\$I<1000),'M&A Database'!\$P:\$P)),"NMF")

Otherwise make sure you sheet names are correct.

As far as adding conditions, you are correct.

If a condition is true, it will result in a 1.  Then for an individual row, if any condition is not met it will be zero and the result of the multiplication will be zero.  Zero is equivalent to False.

--
Regards,
Tom Ogilvy

Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Learned something new, thanks!

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.