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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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