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

#### custhasno

##### New Member
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?

#### njimack

##### Well-known Member
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)

#### AlanY

##### Well-known Member
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

#### custhasno

##### New Member
Solved with the first one but both have shown me something new, thanks folks.

you're welcome

#### custhasno

##### New Member
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:

=day(a1)=0

#### custhasno

##### New Member
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?