If a calculation equals 0 can i display 1?

peterderrington

New Member
Joined
Aug 6, 2019
Messages
26
Office Version
  1. 2019
Platform
  1. Windows
Hi,
I have a sheet that calculates length of stay, all fairly easy, just subtract column D from Column AE.
The problem i have is that if the answer returns 0 (they arrived and left on the same day) i want it to return 1.
The current formula looks like this and displays nothing at all if either field is blank - i need to retain that feature:
=IF(OR(ISBLANK(D5),ISBLANK(AE5)),"",AE5-D5)

My gut says that a SUMIFS formula could help me here but i'm tying myself up in knots.

Can anyone help?

Thanks
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Does this do what you want?

Excel Formula:
=IF(OR(ISBLANK(D5),ISBLANK(AE5)),"",MAX(AE5-D5,1))
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0
I mean if i arrive today and go tomorrow thats two days isnt it?
You'd think wouldn't you? But no in this instance if you arrived today and go tomorrow then thats just 1 day.
If you arrive today and leave later today we've still seen you in one day.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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