Incorrect outputs from my formula revolving dates between rows

Hi, so I am having issues here where this formula is outputting incorrect values

It should be finding tasks it overlaps with, then finds how many days they overlap and outputs this

I have multiple columns of this for each instance of overlap so if another row overlaps it would be outputed in 2

An example of an issue is in my current row 14/05/25-20/05/25 it overlaps with 19/05/25-23/05/25

The latest start date here is 19/05/25, the earliest end date is 20/05/25, so the output should be 2

However, my current formula is outputting 5, which suggets it is literally just finding network days for the current row instead

=IF([is Parent]@row, "", IFERROR(NETWORKDAYS(MAX([Target Start]@row, INDEX([Target Start]:[Target Start], INDEX(COLLECT([Row ID]:[Row ID], [is Parent]:[is Parent], 0, [Assigned To Helper]:[Assigned To Helper], =[Assigned To Helper]@row, [Row ID]:[Row ID], <>[Row ID]@row, [Target Start]:[Target Start], <=[Target End]@row, [Target End]:[Target End], >=[Target Start]@row), 1))), MIN([Target End]@row, INDEX([Target End]:[Target End], INDEX(COLLECT([Row ID]:[Row ID], [is Parent]:[is Parent], 0, [Assigned To Helper]:[Assigned To Helper], =[Assigned To Helper]@row, [Row ID]:[Row ID], <>[Row ID]@row, [Target Start]:[Target Start], <=[Target End]@row, [Target End]:[Target End], >=[Target Start]@row), 1)))), 0))

I have another column that outputs the row IDs of the rows that overlap, so not sure if I could instead use this?

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!