Best function to use

jjmarquez89

New Member
Joined
Jul 27, 2016
Messages
11
Hi There! Hope someone could help. I believe an if function is the best way to go. I just can not figure out how to write it. I am open to other functions as well.

Goal if there isn't a date in the cell in column A the cell in column C would be blank, if there was a date the time to fill will be added, but if there was a date in column D then column C would be blank as well.

Formula in column B - =now()
Formula in column C - =IF(A2="","",IF(A2<>"",NETWORKDAYS(A2,B2)))
- I need to add a condition if D has a value become blank

Thank you for all your help
 

Attachments

  • Capture.JPG
    Capture.JPG
    32.1 KB · Views: 5

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I believe all you need is an AND function to your conditions:

Excel Formula:
=IF(AND(A2<>"",D2=""),NETWORKDAYS(A2,B2),"")
 
Last edited by a moderator:
Upvote 0
I believe all you need is an AND function to your conditions:

=IF(AND(A2<>"",D2=""),NETWORKDAYS(A2,B2),"")
I thought that was the case but I was digging into and function and both statements have to be true for it to work. There won't always be 2 true statements. Thanks for the help.
 
Upvote 0
To solve this issue I used the ifs function
Glad to hear you got the solution.

Is it possible to send the formula you used, so it also helps the future readers? Then it is perfectly fine to mark your own post as the solution.
 
Upvote 0
@smozgur Thanks for the suggestion here is the final formula

Excel Formula:
=IFS($B2="","",$Y2<>"",DAYS($Y2,$B2),$B2<>"",DAYS($W2,$B2))

Thought process with IFS you just need the argument and what you want it to do. Keep in mind it will stop after it finds the first true statement. So when organizing your statements make sure they play out in the right order.

A lot of trial and error went into this.
 
Upvote 0
Solution
Although we can see that the structure has changed, the original question and data structure can be handled with @Misca's approach, with only one change - using OR instead of AND.

Excel Formula:
=IF(OR(A2<>"",D2=""),NETWORKDAYS(A2,B2),"")


Thought process with IFS you just need the argument and what you want it to do. Keep in mind it will stop after it finds the first true statement. So when organizing your statements make sure they play out in the right order.
Right, this is the correct definition of the IFS function. It is a powerful function. The IF equivalent of this formula:

Excel Formula:
=IF($B2="","",IF($Y2<>"",DAYS($Y2,$B2),DAYS($W2,$B2)))

However, please note that you won't get the correct value if W2 and Y2 are both empty where B2 is not in either case since you are not checking for that situation.

Thanks for the feedback. This way, future readers can find solutions for their questions.
 
Upvote 0

Forum statistics

Threads
1,215,796
Messages
6,126,957
Members
449,350
Latest member
Sylvine

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top