You are here:

Excel/merging array formulas

Advertisement


Question
Hi Tom

You recently wrote two array formulas for me which worked perfectly.  You then showed me how they could be applied contingent on an IF condition.  I have arranged both sets of source data in exactly the same way in one workbook and applied the new array formula.  The combined formulas are:

Formula 1
=IFERROR(SMALL(IF(((INDEX($H$1:$N$1500,0,MATCH($A$3,$H$2:$N$2,0))="Contributor")+(INDEX($H$1:$N$1500,0,MATCH($A$3,$H$2:$N$2,0))="Owner"))>0,ROW($E$1:$E$1500)),ROW(E1)),"")

and

Formula 2
=IFERROR(SMALL(IF(($O$3:$O$103=$A$3)*((($I$3:$I$103="Contributor")+($I$3:$I$103="Owner")+($J$3:$J$103="Contributor")+($J$3:$J$103="Owner")+($K$3:$K$103="Contributor")+($K$3:$K$103="Owner")+($L$3:$L$103="Contributor")+($L$3:$L$103="Owner")+($M$3:$M$103="Contributor")+($M$3:$M$103="Owner")+($N$3:$N$103="Contributor")+($N$3:$N$103="Owner"))>0),ROW($A$3:$A$103)),ROW($A1)),"")

The condition is:

=if(And(A1>=1,A2<=9)

So that if the figure in cell A1 is less than 10 then formula 2 is applied otherwise formula 1 is applied.  The combined formula is:

=if(And(A1>=1,A2<=9),IFERROR(SMALL(IF(($O$3:$O$103=$A$3)*((($I$3:$I$103="Contributor")+($I$3:$I$103="Owner")+($J$3:$J$103="Contributor")+($J$3:$J$103="Owner")+($K$3:$K$103="Contributor")+($K$3:$K$103="Owner")+($L$3:$L$103="Contributor")+($L$3:$L$103="Owner")+($M$3:$M$103="Contributor")+($M$3:$M$103="Owner")+($N$3:$N$103="Contributor")+($N$3:$N$103="Owner"))>0),ROW($A$3:$A$103)),ROW($A1)),""),IFERROR(SMALL(IF(((INDEX($H$1:$N$1500,0,MATCH($A$3,$H$2:$N$2,0))="Contributor")+(INDEX($H$1:$N$1500,0,MATCH($A$3,$H$2:$N$2,0))="Owner"))>0,ROW($E$1:$E$1500)),ROW(E1)),""))

However this new formula does not produce the desired result.  I have tried to figure out the problem for a couple of hours but to no avail.  

Could you possibly explain where I might have gone wrong?  This new formula needs to be applied in cell AF3 and then copied down to cell AF100

Thanks in advance

Chris

Answer
Christopher,

If you want to send me a sample workbook I can take a look.  I simply took the two formulas you furnished and combined them as you asked.  I didn't spend time analyzing the individual formulas or imagining what your data might look like.  It seems inconsistent that with the same data set you would look at either row 3 to row 103  or row 1 to row 1500.  

But I would have to see the data and test the formula to see what is possible.

twogilvy@msn.com

--
Regards,
Tom Ogilvy  
About Excel
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

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


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.

©2016 About.com. All rights reserved.