2

I am trying to query a Google Sheet from a separate tab. I want to total minutes, between a certain date range, with a particular userid. I want the dates to be entered by the user as well as the userid.

My query is currently:

select SUM(Col28) where Col1 is not null and Col1 <> 'Timestamp' and Col1 >= '"&$A4&"' AND Col1 <= '"&$B4&"' and Col3 = 'ROS756'

What I get in the cell that contains the query is simply the word sum. I am not getting an error and feel like I am so close!!

player0
  • 124,011
  • 12
  • 67
  • 124
Tom Nahas
  • 23
  • 2

1 Answers1

0

try:

"select sum(Col28) 
 where Col1 >= date '"&TEXT(A4; "yyyy-mm-dd")&"' 
   and Col1 <= date '"&TEXT(B4; "yyyy-mm-dd")&"' 
   and Col3 = 'ROS756'"
player0
  • 124,011
  • 12
  • 67
  • 124
  • Let me take it one step further. Pretty much the same formula, but i want to get a mileage total. Col29 is the Odometer Start for that record Col30 is the Odometer End. I need to find the mileage for each row and total, just like we did with the minutes. =QUERY(IMPORTRANGE("1f-XOO3PQvmBEwQltz3sdVxQqWsqldUn2CI7q_Dbgqzk","Sheet1!$A$2:$AW$10000"), "select sum(Col30-Col29) where Col1 >= date '"&TEXT(F5, "yyyy-mm-dd")&"' and Col1 <= date '"&TEXT(G5, "yyyy-mm-dd")&"' and Col3 = '"&$H5&"'") – Tom Nahas Jan 09 '20 at 17:56