=IFERROR help

Krisco

New Member
Joined
Sep 26, 2021
Messages
9
Office Version
  1. 365
Platform
  1. MacOS
Hi Everyone,

I am trying to use this formula =IFERROR(AVERAGE(Y8:Y1007),"") in cell F5 in my Backtesting Spreadsheet but it doesn't seem to work. I am wanting it to give me the average of column Y to show me the average Risk/Reward Per Trade. It seems to not be working due to the #DIV/01 error in the other cells that is created from that formula. Just wandering if anyone has a work around for this or is my formula missing something?

Thanks
Krisco

Test - Main - 2 target back - forward - live trading & testing spreadsheet.ods
BCDEFGHIJKLMNOPQRSTUVWXYZAAABAC
3D4hr1hr
4AVG % GainsAVG stop lossBull MarketBear MarketAVG R/RWinning %Total trades No. TradesTotal winsTotal lossesTotal % Wins (Long)Total % Wins (Short)% Sold at TP1% Sold at TP2WinLossWinLossWinLossTotal $ Gain/LossTotal % Gain/LossStarting balanceRisk % per positionMAX DrawdownMAX Drawdown
539.68%5.92%33%33% 75%431200%100%70%30%40%60%33%67%0%100%$15,399.70154.00%$10,000.001.00%-5.00%-1.93%
6TRADE DATAORDER INFOTIMEFRAME STATSPNL STATSEXIT INFO
7Long/ShortBull/Bear/Sideways Market On Higher TimeframePAIRDateTimeATR UsedStop Loss PriceStop Loss Distance from Entry in (%)Entry PriceTP 1 (Sold at)Profit $ (TP 1)Profit (TP1) (%)TP 2 (Sold at)Profit $ (TP 2)Profit (TP 2) (%)Position Size (How many Coins/Shares)Timeframe (D, 4hr, 1hr)Win/Loss Per Trade ($)Total Account CashTotal % Gain/Loss Per TradeTotal % Gain/Loss from Start BalanceDrawdownRisk $ per positionRisk/Reward Per TradeExit DateExit TimeExit ReasonExit Price
8LongBull1.536,516.005.92%38,812.0051,731.00$9,043.3023.30%$60,000.00$6,356.4016.38%1690.42D$15,399.70$25,399.70154.00%154.00%0.00%$100.003.9047,769.00
9ShortBear52,156.0050,548.00-$35,383.60-70.00%-$15,164.40-30.00%D$300.00$25,699.703.00%157.00%0.00%$257.009.9534,541.00
10LongSideways$0.00#DIV/0!$0.00#DIV/0!4hr$200.00$25,899.702.00%159.00%0.00%$259.00#DIV/0!
11short$0.00#DIV/0!$0.00#DIV/0!4hr-$500.00$25,399.70-5.00%154.00%-1.93%$254.00#DIV/0!
12Long$0.00#DIV/0!$0.00#DIV/0!4hr$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
13short$0.00#DIV/0!$0.00#DIV/0!D$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
14short$0.00#DIV/0!$0.00#DIV/0!D$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
15$0.00#DIV/0!$0.00#DIV/0!D$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
16$0.00#DIV/0!$0.00#DIV/0!1hr$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
17$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
18$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
19$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
20$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
21$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
22$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
23$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
24$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
25$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
26$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
27$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
28$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
29$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
30$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
31$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
32$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
33$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
34$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
35$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
36$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
37$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
38$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
39$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
40$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
41$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
42$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
43$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
44$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
45$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
46$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
47$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
48$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
49$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
50$0.00#DIV/0!$0.00#DIV/0!$0.00$25,399.700.00%154.00%-1.93%$254.00#DIV/0!
Strategy
Cell Formulas
RangeFormula
B5B5=IFERROR(AVERAGEIF(M8:M1007,">0")+AVERAGEIF(P8:P1007,">0"),"")
C5C5=AVERAGE(I8:I1007)
D5D5=COUNTIF(C8:C1007,"Bull")/COUNTA(C8:C1007)
E5E5=COUNTIF(C8:C1007,"Bear")/COUNTA(C8:C1007)
F5F5=IFERROR(AVERAGE(Y8:Y1007),"")
G5G5=I5/(J5+I5)
H5H5=I5+J5
I5I5=COUNTIF(S8:S1007,">0")
J5J5=COUNTIF(S8:S1007,"<0")
K5K5=COUNTIFS(B8:B1007,"Long",S8:S1007,">0",B8:B1007,"<>")
L5L5=COUNTIFS(B8:B1007,"Short",S8:S1007,">0",B8:B1007,"<>")
N5N5=100%-M5
P5,R5,T5P5=IFERROR(COUNTIFS($R8:$R1007,P3,$S8:$S1007,">0")/COUNTIF($R8:$R1007,P3),NA())
Q5,S5,U5Q5=1-P5
V5V5=SUM(S8:S1007)
W5W5=V5/X$5
Z5Z5=MIN(U8:U1007)
AA5AA5=MIN(W8:W1007)
I8I8=(J8-H8)/J8
L8:L50L8=(K8-J8)*M$5
M8:M50M8=((K8-J8)/J8)*M$5
O8:O50O8=(N8-J8)*N$5
P8:P50P8=((N8-J8)/J8)*N$5
Q8Q8=(X5*Y$5)/I8
S8,S12:S50S8=IF(AB8="S",(H8-J8))+L8+O8
T8T8=(X5+S8)
U8:U50U8=(S8/X$5)
V8:V50V8=(T8-X$5)/X$5
W8:W50W8=(T8/MAX($T$5:U8)-1)
X8X8=IFERROR(X5*Y$5,"")
Y8:Y50Y8=(AC8-J8)/(J8-H8)
T9:T50T9=(T8+S9)
X9:X50X9=IFERROR(T9*Y$5,"")
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try this in F5

Excel Formula:
=AGGREGATE(1,6,Y8:Y1007)
 
Upvote 0
Another option would be to eliminate the errors from column Y by using this in Y8 copied down
Excel Formula:
=IF(J8=H8,"",(AC8-J8)/(J8-H8))

Then in F5 you could just use
Excel Formula:
=AVERAGE(Y8:Y1007)
 
Upvote 0
Solution
Another option would be to eliminate the errors from column Y by using this in Y8 copied down
Excel Formula:
=IF(J8=H8,"",(AC8-J8)/(J8-H8))

Then in F5 you could just use
Excel Formula:
=AVERAGE(Y8:Y1007)
Hi Peter_SSs,

Thanks for your help. They both seem to work fine. I have decided to use your 2nd option as I understand it better. Thanks ?
 
Upvote 0
You're welcome. Second option will also make your worksheet look a lot better. :biggrin:
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top