if-statementgoogle-sheetsdrop-down-menugoogle-sheets-formuladropdown

Google Sheets, Trying to run a formula only if the value cells are greater than 0


Having trouble with the If/Then coding in Google Sheets.

I am tring to run this formula

=ROUND((((F2+(G2*1.25))+H2*0.5)+I2)/3.75)

But only if F2, G2, H2, and I2 are greater than 0.

I can't use the IF ISBLANK function because F2, G2, H2, and I2 are dropdowns and the null set is 0.


Solution

  • Use AND inside the IF Function

    The basic formula for your scenario should look like this:

    IF(AND(F2>0, G2>0, H2>0, I2>0), <FORMULA>, 0)
    

    Wherein the AND function checks if all of the values from F2, G2, H2, and I2 are greater than 0. The IF function will then process the data (just replace <FORMULA> with your desired formula) once all values are greater than 0.

    Hence, your new formula should look like this:

    IF(AND(F2>0,G2>0,H2>0,I2>0), ROUND((((F2+(G2*1.25))+H2*0.5)+I2)/3.75), 0)
    

    Reference: