I have the attached workbook. I need the formula to review the other worksheet to return value when the below criteria is met:
- It is in between the Open Datetime and New Closing Time
If trade is a Buy: - Is greater than 10+ Open Price
- The value in K of the same row as the potential result is greater than the potential value
If Trade is a Sell: - Is less than 10 - Open Price
- The value in L of the same row as the potential result is less than the potential value
I have tried Index/Match, XLookup, Filter, and Aggregate formulas. But none of them work. I had a friend take a look and he thinks there is something about the arrays that is not working.
I have all the formulas I was trying in the attached workbook with sample data. As can see on the GBPAUD worksheet, I highlighted the green row where the result (in red) that actually meets the criteria. So I know wwhat the value should be returned, but the formulas are not returning that value.
=IFERROR(AGGREGATE(15,6,GBPAUD!$A$1:$A$10/(GBPAUD!$A$1:$A$10>=$C4)/(GBPAUD!$A$1:$A$10<=$W4)/(IF($F4="Buy",GBPAUD!$O$1:$AR$10>=($J4+($Y$1/$T4)),GBPAUD!$O$1:$AR$10<=($J4-($Y$1/$T4))))/(IF($F4="Buy",GBPAUD!$K$1:$K$10>=GBPAUD!$O$1:$AR$10,GBPAUD!$L$1:$L$10<=GBPAUD!$O$1:$AR$10)),1),"Not Hit")
=IFERROR(INDEX(FILTER(GBPAUD!$A$1:$A$10,(GBPAUD!$A$1:$A$10>=$C4)*(GBPAUD!$A$1:$A$10<=$W4)*(IF($F4="Buy",GBPAUD!$O$1:$AR$10>=($J4+($Y$1/$T4)),GBPAUD!$O$1:$AR$10<=($J4-($Y$1/$T4))))*(IF($F4="Buy",GBPAUD!$K$1:$K$10>=GBPAUD!$O$1:$AR$10,GBPAUD!$L$1:$L$10<=GBPAUD!$O$1:$AR$10))),1),"No Hit")
=IFERROR(INDEX(GBPAUD!$A$1:$A$10,MATCH(0,(GBPAUD!$A$1:$A$10>=$C4)*(GBPAUD!$A$1:$A$10<=$W4)*(IF($F4="Buy",GBPAUD!$O$1:$AR$10>=($J4+($Y$1/$T4)),GBPAUD!$O$1:$AR$10<=($J4-($Y$1/$T4))))*(IF($F4="Buy",GBPAUD!$K$1:$K$10>=GBPAUD!$O$1:$AR$10,GBPAUD!$L$1:$L$10<=GBPAUD!$O$1:$AR$10)),0),1),"No Hit")
=XLOOKUP(1,(GBPAUD!$A$2:$A$10>=$C4)*(GBPAUD!$A$2:$A$10<=$Y4)*(IF($H4="Buy",GBPAUD!$O$2:$AR$10>=($L4+($Y$1/$T$4)),GBPAUD!$O$2:$AR$10<=($L4-($Y$1/$T$4))))*(IF($H4="Buy",GBPAUD!$K$2:$K$10>=GBPAUD!$O$2:$AR$10,GBPAUD!$L$2:$L$10<=GBPAUD!$O$2:$AR$10)),GBPAUD!$A$2:$A$10,"Not Hit")
I would appreciate if anyone could advise me on how do I fix this?
Bookmarks