How do I subtract dates using one formula if a cell has a date in it but another formula if it is blank

jangell

New Member
Joined
Apr 12, 2010
Messages
38
A1 has 7/22/17 18:50:00 in it
A2 has a 7/28/17 22:01:22 in it
A3 is where I want results

I can use a simple text formula to get the diff here =TEXT(a1-a2," d:h:mm") to get the elapsed days hours and minutes.

My problem is when there is no information in A2 (because it is not complete or I do not have a projected completion date) i would like it the formula to use the current date/Time =now() as a replacement for a blank B2 (this formula would sit in E1 to be used as needed) - this would give me an at a glance elapsed days hours minutes result in A3.

I tried =if(sum(a2<>,text(a1-a3),text(a1-a2) and a variety of other guesses but cant get it figured out...

Would appreciate help on this.

Thanks
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Is this what you are looking for?

=TEXT(a1-if(isnumber(a2),a2,today())," d:h:mm")

where a1 <= a2 or a1 <= today's date.
 
Upvote 0
That does not seem to work - It produces a #value error

Is there a way to load a spreadsheet sample up on the board?
 
Upvote 0
Couldn't open your file as it needed a password.
But see if this works:
Excel Workbook
A
17/22/2017 18:50
2
34:1:35
Sheet
 
Upvote 0
You need to change the cell references to match your data.
Excel Workbook
ABCDEF
1NameBew DateFerment Type (Standard or Fast)Ferment StartFerment StopElapsed Frerment Time
2Kayaker Cream Ale7/17/17 20:50Standard7/17/17 22:007/22/2017 8:134:10:13
3Mild Brown7/17/17 22:00Standard7/19/17 22:006:23:35
Sheet
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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