Using IF to specify which type of cell i want to ignore

custhasno

New Member
Joined
Mar 20, 2017
Messages
14
I am currently working on a spreadsheet to show duration between several date/times displayed as DD/MM/YYYY HH:MM. I need to report on the difference between the Request time of a job versus its completion time. The only issue is, not all jobs have a requested time so i have some cells in that range that show as only DD/MM/YYYY which i want to ignore and instead subtract the time the job was allocated from the completion time in a different row. f the request data only shows a date and no time.

My query is, how can i tell the formula that displayed the difference between allocated and completed times when the requested cell only had a date?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Assuming A1 is the cell in question and if it doesn't contain a time you wish to refer to A2.
=IF(TIME(HOUR(A1),MINUTE(A1),0),A1,A2)
 
Upvote 0
excel stores time as part of a day, e.g. 6am = 6/24(hrs) = .25

so cell with dates only are integers with no decimals thus you can check if Cell A1 is date only if

=A1-int(A1) equals to zero
 
Upvote 0
Assuming A1 is the cell in question and if it doesn't contain a time you wish to refer to A2.
=IF(TIME(HOUR(A1),MINUTE(A1),0),A1,A2)

This worked great thanks. Now I'm looking to do something similar in another column but this time i want to ignore any cells that only have a time HH:MM and no date information and use a different cell instead. Is that possible?

So i have Cells which should read DD/MM/YYYY HH:MM but due to a few issues with our system i occasionally get cells with only the HH:MM. I wish to ignore these cells when they do not have date info in them.
 
Last edited:
Upvote 0
Thanks, so to create a formula that goes to B1 if A1 does not contain the date info (only time) it would be =IF(TIME(DAY(A1),0),A1,B1) ? Can i chance my arm and ask is there a way to combine these in to one formula. So if A1 contains no date info (only time) it uses B1 and if A1 contains no time info (only the date) it takes C1 instead?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
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