Combining ISBLANK and NOT(ISBLANK() to calculate dates..(or other suggestions)

vertabatim

New Member
Joined
Oct 2, 2020
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hello,

For a document at work I need to calculate the total days that we have had someone stay at our property. Something that should look like below.

RoomRoom (per person)Date inPlanned Date Out Actual Date OutTotal Nights
1511151125/09/20209/10/20207
151125/09/20209/10/2020
30230223/09/202007/10/202024/09/20201
2121212110/09/202024/09/202007/10/202014
212110/09/202024/09/202007/10/2020

So my "logic" to calculate is
IF A1 is not blank AND E1 is Blank then DATEDIF(c1,now(),"d")
Otherwise
IF A1 is not blank and E1 is not blank then DATEDIF(c1,e1(),"d)

I am really struggling to get my head around the multiple isblank or not(isblank) functions.

Current work in progress is

=IFERROR(OR(IF(ISBLANK(A1),"",(DATEDIF(A1,E1,"d"))),""),(IFERROR(IF(ISBLANK(A1),"",(DATEDIF(C21,NOW(),"d"))),"")))

Hoping there is a much easier way to do this...

Hopefully this makes enough sense as my brain is slowly losing function the more I stare at this.

Regards,
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi & welcome to MrExcel.
How about
+Fluff New.xlsm
ABCDEF
1RoomRoom (per person)Date inPlanned Date OutActual Date OutTotal Nights
21511151125/09/202009/10/20207
3151125/09/202009/10/2020 
430230223/09/202007/10/202024/09/20201
52121212110/09/202024/09/202007/10/202027
6212110/09/202024/09/202007/10/2020 
Data
Cell Formulas
RangeFormula
F2:F6F2=IF(A2="","",IF(E2="",TODAY()-C2,E2-C2))
 
Upvote 0
Try This

=IF(A2="","",IF((A2<>"")*(E2<>""),DATEDIF(C2,E2,"d"),DATEDIF(C2,NOW(),"d")))

But how did you get 14 in row 4..
 
Upvote 0
Hello and thank you,

Fluff it looks like that has done the trick for me, I have been making it progressively more complicated for my self so it was nice to see it simple.

And thanks CA_Punit, and you are correct that was my bad should look more like the below.
RoomRoom (per person)Date inPlanned Date OutActual Date OutTotal Nights
1511151125/09/20209/10/20207
151125/09/20209/10/2020
30230223/09/202007/10/202024/09/20201
2121212110/09/202024/09/202024/09/202014
212110/09/202024/09/202024/09/2020

Regards,
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,882
Messages
6,175,166
Members
452,615
Latest member
bogeys2birdies

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