Search code examples
filtergoogle-sheetsgoogle-sheets-formulagoogle-sheets-querygoogle-query-language

Copy row if cell value more than 0 - Google Sheets


I have some cells in a spreadsheet that I am trying to use to do some price calculations for some different services. Each row has:

  • The name of each service
  • The quantity of the service that is being requested
  • The price per unit of the service
  • Finally, the total price which is calculated by multiplying the unit price by the quantity

However, I have done this for 10-15 services and as such not all the services will be used every time. So now I would like to try and create a summarised version which would explain exactly the same information as above but only for the chosen options. To work out which services to show, I planned on filtering to show only if the calculated price is more than 0

I have seen that there is the FILTER function and so I tried to do the following:

=FILTER(F6:F9, F6:F9 > 0)

This does do the basic job of only showing the values that are more than 0. However, is there a way that I can extend this to also copy over information from the columns beside it? Or would I have to use another function or a script to achieve this?


Solution

  • all you need to do is extend FILTER range like:

    =FILTER(F6:H9, F6:F9 > 0)
    

    it could even be like:

    =FILTER(A6:B9, F6:F9 > 0)
    

    but you can use QUERY if you prefer like:

    =QUERY(A6:Z9, "select F,G,H where F > 0", 0)