# I need help writing a formula.

Options
edited 06/12/23

Logic

if cell b >0, then calculate the Sum Cell b-cell a

• ✭✭✭✭✭✭
Options

You would need to add another column to be able to make that calculation.

• ✭✭✭✭✭✭
Options

=IF([ColA]@row > 0, [ColB]@row - [ColA]@row, 0)

If ColA is <=0 then it will return 0

(change "ColA" and "ColB" to your actual column names)

Hope this helps!

• edited 06/12/23
Options

It gave me back #Circular Reference

this is the formula I made

=IF(May@row > 0, April@row - May@row, 0)

It did not change if I put the row name in brackets [ ]

• ✭✭✭✭✭✭
Options

Are you putting the formula into the May or April row?

• Options

into the May row

• ✭✭✭✭✭✭
Options

Which column are you pasting this formula into? Sounds like you're executing this formula in cell b if you're getting a circular reference. This formula won't work in cell/column b because it's the cell being evaluated and written to.

• Options

Yes I do get a circular reference. What I want to do if possible is if the month = \$0 leave it as \$0. but if the month is greater than \$0 then take that amount and subtract it from the previous months amount to get the difference.

• ✭✭✭✭✭✭
Options

You would need to add another column to be able to make that calculation.

• Options

Ok, thank you!

• ✭✭✭✭✭✭
Options

I believe once you reference that other column from the May (cell b) column, your circular reference error will return.

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!