Search code examples
google-sheets

How to SUM column while using a condition on each cell


I'm using Google Sheets and i have a table with 2 columns: PRICE(A) and REQUIRED(B):

--------------------
| PRICE | REQUIRED |
--------------------
| 10000 | *        |
|  1200 | *        |
|  1550 |          |
|  5000 |          |
| 12000 | *        |
--------------------

I need to calculate the SUM of the column A (PRICE) but only if REQUIRED is set (has a star) so basically i need to go through the PRICE column, and check each cell to see if the REQUIRED cell is set for it.

How can i accomplish this ?


Solution

  • sumif() would suffice

    =sumif(<Required_column>, "*", <Price_column>)
    

    example: =sumif(B:B,"*",A:A)