# Adding NETWORKDAYS to a formula gives #INVALID DATA TYPE

Options
✭✭

Hi,

Happy Friday!!

Please see below - I know I'm missing something simple. Any thoughts?

I have a little formula that allows me to have a col formula and also have SUM(CHILDREN()).

Date cols are both dates.

Target total duration col is text / number.

When I don't use NETWORKDAYS, I get the total duration as expected, please see the formula and snip below.

=IF([HC-Calc]@row = 1, "", IF(COUNT(CHILDREN()) = 0, [Target End Date]@row - [Target Start Date]@row, SUM(CHILDREN())))

When I update the formula to include NETWORKDAYS, to give the work day duration, and update the start / end date in the formula, I get our old friend #INVALID DATA TYPE. Please see the formula and snip below.

=IF([HC-Calc]@row = 1, "", IF(COUNT(CHILDREN()) = 0, NETWORKDAYS([Target Start Date]@row, [Target End Date]@row, SUM(CHILDREN()))))

Thanks for any help.

• ✭✭✭✭✭✭
Options

Double and triple check your two date columns are in fact set as date type columns. If they definitely are, how exactly are they being populated?

• ✭✭
Options

Hi,

After finding this post (Thanks @Kelly Moore @Xavier Gomez )

I think I have fixed it with

=IF([HC-Calc]@row = 1, "", IF(COUNT(CHILDREN()) > 0, SUM(CHILDREN()), IF(AND(ISDATE([Target Start Date]@row), ISDATE([Target End Date]@row)), NETWORKDAYS([Target Start Date]@row, [Target End Date]@row))))

• ✭✭
Options

@Paul Newcome Hi, they are date cols, and they will be keyed in by the planners.

The revised formula looks like it works.

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!