# Create a formula based on duplicate values

Options
✭✭✭
edited 11/02/22

Hello, I need some assistance with a formula.

I have the following sheet with an 'Original SOW#' & 'Approved Change Order Amount' columns. I would like to sum up the Approved Change order Amount by Original SOW#.

Example, for SOW# 012, the sub-total should be \$117,000 since I added \$67K + \$50k from the Approved Change Order amount column.

The above formula should work anytime there is a duplicate value in the Original SOW# (in the above example we have two rows with 012).

Here is the formula I am currently using but not working since I have not figured out a way to find the duplicates:

=SUMIFS([Approved Change Order Amount]:[Approved Change Order Amount], [Original SOW #]: [Original SOW #], CONTAINS([Original SOW #]\$1: [Original SOW #], @cell), Status:Status, "Approved")

Thank you

• ✭✭✭✭✭✭
Options

Try with a Collect function:

=Sum(Collect([Approved Change Order Amount]:[Approved Change Order Amount],Status:Status, ="Approved",[Original SOW #]:[Original SOW #],=[Original SOW #]@row)

The thing with this funciton though is that Row 1 and Row 3 will have the same value, the total of all Change order amount.

• ✭✭✭✭✭✭
Options

Try with a Collect function:

=Sum(Collect([Approved Change Order Amount]:[Approved Change Order Amount],Status:Status, ="Approved",[Original SOW #]:[Original SOW #],=[Original SOW #]@row)

The thing with this funciton though is that Row 1 and Row 3 will have the same value, the total of all Change order amount.

• ✭✭✭
Options

@Christian G. Thank you! It worked.

• ✭✭✭
Options

@ChristianCo. Hi there, in terms of the above formula that you provided, I would like to add an additional parameter. Instead of getting the sub-total by SOW # only, I also would like to get the sub-total based on SOW # AND Vendor Name.

For instance, the following example shows 2 different vendors (Apple and Watermelon). The sub-total for Apple should be \$30k, whereas for Watermelon should be \$50k.

I am assuming I need to add the 'Vendor Name' component to the formula you provided. Thoughts?

=Sum(Collect([Approved Change Order Amount]:[Approved Change Order Amount],Status:Status, ="Approved",[Original SOW #]:[Original SOW #],=[Original SOW #]@row)

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!