# I have problems with conditions

#### Greenlee

##### New Member
I think its quite complicated so I would need to show you but i will try

So this is my table (sheet name: BACKTESTING)
Gyazo - 18e6618f6f26ba50b4937012cb11de5a.png

This is my second sheet (sheet name BACKTESTING RESULTS)

So what do I want to do:

so this is the formula for now:
=COUNTIFS(BACKTESTING!D3:D7;"=BAT";BACKTESTING!B3:B7;"=EUR/AUD";BACKTESTING!C3:C7;"=M15";BACKTESTING!K3:K7;"=1") from backtesting page but I want to add 2 more conditions from 2nd sheet
1st when you choose TF=timeframe M15 that would show results for M15 not for M5,H1 or H4 and second when I would choose on the right side EUR/AUD it would show EUR/AUD not also EUR/JPY ( dropdown of currencies) ...

If I was not understandable enough please let me know

### Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Which cells define the conditions? So, which cell is the timeframe in? Which cell is the currency in?

Chris.

Timeframe is E3, currency is F2

I'm still not entirely sure of the timeframe condition, what values will actually be in the cell, and what will happen based on those values?

Here is what I have so far:

Code:
``=IF(E3="TF",COUNTIFS(BACKTESTING!D3:D7;"=BAT";BACKTESTING!B3:B7;F2;BACKTESTING!C3:C7;"=M15";BACKTESTING!K3:K7;"=1"),COUNTIFS(BACKTESTING!D3:D7;"=BAT";BACKTESTING!B3:B7;F2;BACKTESTING!C3:C7;"=M5";BACKTESTING!K3:K7;"=1"))``
Chris.

I will try to explain one more time

So what I would like to do: This is the following condition: COUNTIFS(BACKTESTING!D3:D7;"=BAT";BACKTESTING!B3:B7;"=EUR/AUD";BACKTESTING!C3:C7;"=M15";BACKTESTING!K3:K7;"=1") from BACKTESTING sheet so where says the window TRADES: I would like to have this condition COUNTIFS(BACKTESTING!D3:D7;"=BAT";BACKTESTING!B3:B7;"=EUR/AUD";BACKTESTING!C3:C7;"=M15";BACKTESTING!K3:K7;"=1") but Timeframe should be M15(15minutes)(dropdown) and currency should be EUR/AUD(dropdown) becuase if I would use M5(5minutes) then this condition should give me different results then the timeframe for M15

So this works?

Code:
``=COUNTIFS(BACKTESTING!D3:D7;"=BAT";BACKTESTING!B3:B7;F2;BACKTESTING!C3:C7;E3;BACKTESTING!K3:K7;"=1")``
Chris.

This code works but this code is from Backtesting sheet so I need 2 more conditions from Backtesting Result sheet ( Gyazo - 218c99689d7f19947b003b7d7f7154e3.png - Backtestin Result sheet ) from this sheet I need to add 2 more condition to pick TimeFrame and Currency:

Example: (this code is for backtesting sheet=COUNTIFS(BACKTESTING!D3:D7;"=BAT";BACKTESTING!B3:B7;F2;BACKTESTING!C3:C7;E3;BACKTESTING!K3:K7;"=1") + now I need to add if I pick TF:M15 and Currency:EUR/AUD) will show me this results if I choose TF5 and Currency EUR/AUD will not show me this results.

Actually I need to add to this code
=COUNTIFS(BACKTESTING!D3:D7;"=BAT";BACKTESTING!B3:B7;F2;BACKTESTING!C3:C7;E3;BACKTESTING!K3:K7;"=1")</pre> those two conditions: show me those results if I pick TF15 and Currency EUR/AUD

Thank you very much sorry for being not clear

</pre>

So you'd want to say:

Code:
``=IF(OR(E3<>"M15",F2<>"EUR/AUD"),"",COUNTIFS(BACKTESTING!D3:D7;"=BAT";BACKTESTING!B3:B7;F2;BACKTESTING!C3:C7;E3;BACKTESTING!K3:K7;"=1"))``
Chris.

Yes yes yes, Thank you very much, but one more thing if I change time frame to M5, I should only extend this code right?

You're welcome.

I don't really understand the question, but if you wanted to swap M15 and M5 you can just switch them round in the code.

Chris.

Replies
1
Views
402
Replies
1
Views
553
Replies
6
Views
916
Replies
5
Views
397
Replies
3
Views
867

1,221,423
Messages
6,159,822
Members
451,591
Latest member
j0eyjedi

### 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.

### Which adblocker are you using?

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

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