You are here:

# Excel/merging array formulas

Question
Hi Tom

I am trying to merge these two array formulas in the following way?
If the number in cell A1 = 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 then run formula 2 otherwise run formula 1.  Can this be done with array formulas?  If so can you show me how?

Chris

Formula 1
=IFERROR(SMALL(IF(((INDEX(\$D\$1:\$J\$1500,0,MATCH(\$N\$2,\$D\$2:\$J\$2,0))="Contributor")+(INDEX(\$D\$1:\$J\$1500,0,MATCH(\$N\$2,\$D\$2:\$J\$2,0))="Owner"))>0,ROW(\$A\$1:\$A\$1500)),ROW(A1)),"")

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)),"")

if(And(A1>=1,A2<=9),IFERROR(SMALL(IF(((INDEX(\$D\$1:\$J\$1500,0,MATCH(\$N\$2,\$D\$2:\$J\$2,0))="Contributor")+(INDEX(\$D\$1:\$J\$1500,0,MATCH(\$N\$2,\$D\$2:\$J\$2,0))="Owner"))>0,ROW(\$A\$1:\$A\$1500)),ROW(A1)),""),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)),""))

entered with Ctrl+Shift+Enter

if made both A1's in the AND function relative, but if they need to be absolute, then change it to absolute.

--
Regards,
Tom Ogilvy

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.