Search code examples
excelexcel-formulaexcel-2013forex

Trying to use countif with multiple criteria involving a time range and a set amount


Needing to automate results of alerts within certain time frames based on a 24 hour clock (00:00:00). I believe that a COUNTIF command may be a solution, but not really sure how to use or setup.

Here are my columns that I am trying to use... E11:E61 - represents my time. I am looking to pick out those values that fall within 02:00:00 - 06:59:59 from this column.

Then, after filtering that answer. I need to see which of cells in that time frame equal a win or a loss. My column for win or losses is Q11:Q61. That will be one separate field that I will calculate this in.

Then, in another field, I need to calculate a win amount based on whether a cell falls within the time frame and shows a win. My win amount column is U11:U61.

So, a little more complicated than my experience allows me to solve. So, I could whatever suggestions or recommendations for solving this.

This has been a great resource for me, and I appreciate everyone's input.


Solution

  • As guitarthrower suggested in the comments, you could use the COUNTIFS function to achieve what you are looking for:

    WINS =COUNTIFS(E11:E61,">=2:00:00",E11:E61,"<=6:59:59",Q11:Q61, "WIN")

    LOSSES =COUNTIFS(E11:E61,">=2:00:00",E11:E61,"<=6:59:59",Q11:Q61, "LOSS")