I'm trying to enter this in as a macro, but I'm having trouble because the formula array needs to be less than 255 characters. I just want to have my macro fill all cells in my table6 with the array below. Any suggestions?
VBA:
Range("H31").Select
Selection.FormulaArray = _
"=IFERROR(IF(IF([@[Generation Planted]]<>""F2"",INDEX(Table45,MATCH(1,([@[Trait(s)]]=Table45[TRAIT])*([@[Embryo/Seed]]=Table45[Input_type]),0),3),IF([@[Generation Planted]]=""F2"",INDEX(Table46,MATCH(1,([@[Trait(s)]]=Table46[TRAIT])*([@[Embryo/Seed]]=Table46[Input_type]),0),3),""""))=0,"""",IF([@[Generation Planted]]<>""F2"",INDEX(Table45,MATCH(1,([@[Trait(s)]]=Table" & _
"])*([@[Embryo/Seed]]=Table45[Input_type]),0),3),IF([@[Generation Planted]]=""F2"",INDEX(Table46,MATCH(1,([@[Trait(s)]]=Table46[TRAIT])*([@[Embryo/Seed]]=Table46[Input_type]),0),3),""""))),"""")"
Selection.AutoFill Destination:=Range("Table6[Selection]"), Type:= _
xlFillDefault
Range("Table6[Selection]").Select
The formula I want to use as an array in H31:H2043 (aka Table6[Selection]):
=IFERROR(IF(IF([@[Generation Planted]]<>"F2",INDEX(Table45,MATCH(1,([@[Trait(s)]]=Table45[TRAIT])*([@[Embryo/Seed]]=Table45[Input_type]),0),3),IF([@[Generation Planted]]="F2",INDEX(Table46,MATCH(1,([@[Trait(s)]]=Table46[TRAIT])*([@[Embryo/Seed]]=Table46[Input_type]),0),3),""))=0,"",IF([@[Generation Planted]]<>"F2",INDEX(Table45,MATCH(1,([@[Trait(s)]]=Table45[TRAIT])*([@[Embryo/Seed]]=Table45[Input_type]),0),3),IF([@[Generation Planted]]="F2",INDEX(Table46,MATCH(1,([@[Trait(s)]]=Table46[TRAIT])*([@[Embryo/Seed]]=Table46[Input_type]),0),3),""))),"")