# How to find, out of many days, 1 day that is most profitable on Google Sheets?

Ok, I've been looking for this type of formula but not finding it. So here I am asking for help.

I'm a day trader on stocks and I want to analyze my performance. For example:

``````+-----------------+--------------+-----------+-----------------+----------+
|      Days       | Profit/Loss  |  Per Day  | Per Day Pr/Loss | Best Day |
+-----------------+--------------+-----------+-----------------+----------+
| Monday          | \$100         | Monday    |           -1088 | Friday   |
| Tuesday         | -\$50         | Tuesday   |           -3550 |          |
| Thursday        | \$21          | Wednesday |            -958 |          |
| Monday          | \$12          | Thursday  |              21 |          |
| Monday          | -\$1200       | Friday    |            5715 |          |
| Wednesday       | -\$1200       |           |                 |          |
| Friday          | \$3200        |           |                 |          |
| Tuesday         | -\$3500       |           |                 |          |
| Wednesday       | -\$300        |           |                 |          |
| Wednesday       | \$42          |           |                 |          |
| Wednesday       | \$500         |           |                 |          |
| Friday          | \$15          |           |                 |          |
| Friday          | \$2500        |           |                 |          |
+-----------------+--------------+-----------+-----------------+----------+
``````

P/L according to days should be:

``````Mondays -\$1088,
Tuesdays -\$3550,
Wednesdays -\$958,
Thursdays \$21,
Fridays \$5715
``````

(How can I calculate this as well?)

And the most profitable days traded from the example above should be `FRIDAY`.

Now my question is, how can I formulate this so that it gives me `Friday` as the answer?

You need to use the `QUERY` and `VLOOKUP` functions:

In cell `D2` place the following formula nad drag it down to cell `D6`

``````=QUERY(\$A\$2:\$C,"select sum(B) where A='"&\$C2&"' label sum(B)''")
``````

In cell `D2` place the following:

``````=Vlookup(max(\$D\$2:\$D),{\$D\$2:\$D,\$C\$2:\$C},2,FALSE)
``````