Monday, July 17, 2023

dipping my toes into Google Sheets functions

So far, I'd been manually adding up numbers for total number of visitors and so on. Today, I tried out using some formulas, via https://productivityspot.com/google-sheets-sumifs-date-range/

=SUMIFS('2023'!F3:F,'2023'!A3:A,">="& E131, '2023'!A3:A,"<="& EOMONTH(E131,0) )

This is one of the formulas - here, 

  • SUMIFS is the conditional sum function
  •  '2023'!F3:F is the range over which we want to sum - the sheet name is within single quotes to convert the number to a string
  • & concatenates two strings to make another string - here, E131 contains a date, first day of the month, and the condition is >={the date}
  • EOMONTH returns the last day of the month of the date specified in the first argument, with an offset of n months where n is the second argument.

Google sheets function list is here

Interestingly, another function I've used for the same chart has a different syntax.

=COUNTIFS('2023'!F2:F,">1",'2023'!A2:A,">="& E131, '2023'!A2:A,"<="& EOMONTH(E131,0))

COUNTIFS does not have the same number of parameters as SUMIFS, so we can't just copy-paste formulas and just change SUM to COUNT. Here,

  • all the parameters have to come in pairs - so I've just added a ">1" condition to the first range.
  • all the ranges must have the same number of rows and columns.

No comments:

Post a Comment