georgedixon
09-18-2017, 09:51 AM
Hi,
I was looking to convert this formula to a VBA custom function:
=IF(D26="",IF(ISNA(INDEX(Sheet5!$E$4:$G$5,MATCH(C26,Sheet5!$E$4:$E$5,0),0)),INDEX(She et5!$E$4:$G$5,MATCH(C26,Sheet5!$E$4:$E$5,0),1), _
INDEX(Sheet5!$E$4:$G$5,MATCH(C26,Sheet5!$E$4:$E$5,0),0)),IF(ISNA(INDEX(Shee t5!$E$4:$G$5,MATCH(D26,Sheet5!$E$4:$E$5,0),0)), _
INDEX(Sheet5!$E$4:$G$5,MATCH(D26,Sheet5!$E$4:$E$5,0),1),INDEX(Sheet5!$E$4:$ G$5,MATCH(D26,Sheet5!$E$4:$E$5,0),0)))
The reason I want to put this within a VBA module is because I need to change the references, and they are a whole lot longer than above (hence they don't fit within a normal formula region)
I was looking to convert this formula to a VBA custom function:
=IF(D26="",IF(ISNA(INDEX(Sheet5!$E$4:$G$5,MATCH(C26,Sheet5!$E$4:$E$5,0),0)),INDEX(She et5!$E$4:$G$5,MATCH(C26,Sheet5!$E$4:$E$5,0),1), _
INDEX(Sheet5!$E$4:$G$5,MATCH(C26,Sheet5!$E$4:$E$5,0),0)),IF(ISNA(INDEX(Shee t5!$E$4:$G$5,MATCH(D26,Sheet5!$E$4:$E$5,0),0)), _
INDEX(Sheet5!$E$4:$G$5,MATCH(D26,Sheet5!$E$4:$E$5,0),1),INDEX(Sheet5!$E$4:$ G$5,MATCH(D26,Sheet5!$E$4:$E$5,0),0)))
The reason I want to put this within a VBA module is because I need to change the references, and they are a whole lot longer than above (hence they don't fit within a normal formula region)