Google sheets date formula and conditional addition for baby feeding

179 views Asked by At

I'm looking for an easy way to account my son's food intake. The trouble is, all of the forms we've used to date are arduous when trying to collect data straight into spreadsheets. So I thought we could use an IFTT/Do button.

A couple problems I need help with:

  1. IFTTT inputs the data as text: how do I use the DATE function to reformat the cell data for each date?
  2. The "button" we're using represents 30 mL of milk but in a single meal he may eat much more - so we're pressing the button multiple times. What array formula can I use to add all formula for each day?

Here's a link to a sample spreadsheet so far. https://docs.google.com/spreadsheets/d/1ds_IvgS5JWuFmsEipk-wUcsfGQVSVD1tXPydDCoT7Xo/edit?usp=sharing

1

There are 1 answers

3
Jeremy Kahan On

I hope you enjoy this special time. I would leave column A alone, probably you get no control on that. But for column B, if you get to, I follow your lead on the condition, but I would want numbers for the results so I can do math on them, so =ARRAYFORMULA(if(A2:A>"0",30,0))

I introduced a column C for Dates and a Column D for times and did the following in C2 to get them:

=arrayformula(if(isblank(A2:A),"",SPLIT(A2:A," at ",false))).

To make these look nice, I formatted the respective columns as dates and times.

In column E I wanted the various dates, so I wrote in E2,

=unique(C2:C)

Then to get the sums per date I had had a really gross QUERY for SUM(B) where C = Date..., and then I saw the comment with the sumif idea. So in F2 you can put the following and drag down as needed:

=sumif(C2:C,E2,B2:B)

and you have your totals by day.