# Sum all values of drinking for a certain day

I'm creating a sheet for my baby milk consumption and I'm trying to have a sum of the milk drank each day.

Here is a picture of the sheet in question:

Now I don't know how to select the value in column C for each day! Any help is appreciated!

• Would you be opposed to copying the date to cover each row? This would make it much simpler to create a summary for each day. You'd just have to use SUMIF. May 7, 2022 at 8:06

If you can repeat the date on every row, use `query()` to aggregate the quantities by day. Put this formula in cell `E1` or another free range outside of `A1:D`:

``````=query(
A1:D,
"select A, sum(C)
where A is not null
group by A",
0
)
``````

If you cannot repeat the date on each row for some reason, use an array formula to fill the dates down, like this:

``````=arrayformula( query(
{
if(
row(B1:B) <= max(row(B1:B) * (B1:B <> "")),
iferror(
vlookup(
row(A1:A),
if( len(A1:A), { row(A1:A), A1:A } ),
2,
true
)
),
iferror(1/0)
),
B1:D
},
"select Col1, sum(Col3)
where Col1 is not null
group by Col1",
1
) )
``````

I ended up using a SUMIF:

``````=SUMIF(A:A; "="&G5; C:C)
``````

what you could do is

1. Add the date in all cells in Column-a (Ex. 5Mai 2022 from A50 to A55, 6 MAi 2022 form A51 to A63, and so on)

1. Use sumif function

This will solve the issue