# Using IF with Networkdays

Options

Hi All,

I am trying to calculate the number of days in SS and adding a clause that if the difference is greater than 45, it should return "No". If it is lower, it should return "YES".

Unfortunately, my code is not working, and I am stuck.

The formula I am using is the following:

= IF((NETWORKDAYS([Sent to NewOrder]2, [Sent to Billing]2)) <= 45, "YES", IF((NETWORKDAYS([Sent to NewOrder]2, [Sent to Billing]2)) > 45, "NO"))

• ✭✭✭✭✭✭
Options

=IF(NETWORKDAYS([Sent to NewOrder]2, [Sent to Billing]2) <= 45, "YES", IF(NETWORKDAYS([Sent to NewOrder]2, [Sent to Billing]2) > 45, "NO"))

There's no need to wrap the NETWORKDAYS in a double set of parenthesis. You also have a space between the = and the IF. You can probably even shorten it to this:

=IF(NETWORKDAYS([Sent to NewOrder]2, [Sent to Billing]2) <= 45, "YES", "NO")

• Options

Hi Mike,

It partially worked. The problem now is that I am getting "YES" even if the results are greater than 45 days.

I am using another formula to confirm the number of days. And that I how I know it is showing for both.

Can you help me with that?

Kind Regards,

Pamella Souza.

• ✭✭✭✭✭✭
Options

Can you please show the formula on your sheet with the 2 columns it's evaluating?

• Options

Hi Mike,

Please refer to the attached picture:

I tested both ways.

Cheers.

• Options

I also thought about storing the difference between two dates in a variable and then using the if to make the comparison.

But I was successful in my tests.

• Options

Anyone?

• ✭✭✭✭✭✭
Options

@Pamella Souza - I am yet to test your formula and would return the answer shortly but in the meantime, try using the IFERROR to your formula instead of IF and run.

Let me know if that works!

Cheers!

Ipshita Mukherjee

• Options

Hi Ipshita,

It worked.

Thank you very much! I appreciate your help.

Have a good one!

Cheers!

• ✭✭✭✭✭✭
Options

Hi @Pamella Souza - I am glad it worked and would really appreciate it if you can give a "Awesome" or something to my response that worked for you.

Cheers :)

Ipshita

Ipshita Mukherjee

• Options

Hi @Ipshita,

I did yesterday!

Thanks a lot.

Cheers!

• ✭✭✭✭✭✭
Options

@Pamella Souza Lol - thank you!

Have a wonderful day :)

Ipshita

Ipshita Mukherjee

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!