mercredi 27 mars 2019

VBA Function query using IF formula

I'm trying to create a VBA function which generates quite a complex formula if there's a particular value in Cell G25. Can anyone help please?

My formula is: =IF(G25="46mm",INDEX(Matrix!A:K,AGGREGATE(15,3,((Matrix!$B$6:$B$13>=M25)/(Matrix!$B$6:$B$13>=M25))*ROW(Matrix!$B$6:$B$13),1),AGGREGATE(15,3,((Matrix!$C$5:$G$5>=I25)/(Matrix!$C$5:$G$5>=I25))*COLUMN(Matrix!$C$5:$G$5),1)),IF(G25="67mm",INDEX(Matrix!A:K,AGGREGATE(15,3,((Matrix!$B$6:$B$13>=M25)/(Matrix!$B$6:$B$13>=M25))*ROW(Matrix!$B$6:$B$13),1),AGGREGATE(15,3,((Matrix!$C$5:$K$5>=I25)/(Matrix!$C$5:$K$5>=I25))*COLUMN(Matrix!$C$5:$K$5),1)),IF(G25="90mm",INDEX(Matrix!A:K,AGGREGATE(15,3,((Matrix!$B$6:$B$13>=M25)/(Matrix!$B$6:$B$13>=M25))*ROW(Matrix!$B$6:$B$13),1),AGGREGATE(15,3,((Matrix!$C$5:$G$5>=I25)/(Matrix!$C$5:$G$5>=I25))*COLUMN(Matrix!$C$5:$G$5),1)))))+AL25

I'm currently using the above formula in Cell AG25 but it's generating a #VALUE! error where there's no content in cell G25.

Ideally this function will apply to any cells in range g25:g56 dependant on the value in range a25:a56

Aucun commentaire:

Enregistrer un commentaire