我是VBA初学者,并且已经整合了一个过于复杂的嵌套公式,有条件地将一行中的多个单元格与不同的工作表进行索引/匹配。
它在理论上有效。但是,根据多行和多列推断,处理需要很长时间。
=IF(F23="",0,IFERROR(INDEX('Sheet1'!$F$2:$F$10000,MATCH(1,(F23='Sheet1'!$B$2:$B$10000)*(G23='Sheet1'!$C$2:$C$99991),0)),IFERROR(INDEX('Sheet1'!$F$2:$F$9999,MATCH(F23,'Sheet1'!$A$2:$A$9999,0)),IFERROR(INDEX('Sheet2'!$G$2:$G$10000,MATCH(1,(F23='Sheet2'!$B$2:$B$10000)*(G23='Sheet2'!$C$2:$C$99991),0)),IFERROR(INDEX('Sheet2'!$G$2:$G$9999,MATCH(F23,'Sheet2'!$A$2:$A$9999,0)),IFERROR(INDEX(Sheet3!$I$2:$I$9999,MATCH(1,(F23=Sheet3!$B$2:$B$9999)*(G23=Sheet3!$C$2:$C$99990),0)),IFERROR(INDEX(Sheet3!$I$2:$I$9999,MATCH(F23,Sheet3!$A$2:$A$9999,0)),IFERROR(INDEX(Sheet4!$F$2:$F$10000,MATCH(1,(F23=Sheet4!$B$2:$B$10000)*(G23=Sheet4!$C$2:$C$99991),0)),IFERROR(INDEX(Sheet4!$F$2:$F$10000,MATCH(F23,Sheet4!$A$2:$A$10000,0)),0)))))))))
使用VBA简化配方以使其高效处理的正确方法是什么?我应该创建一个UdF吗?