Assign a Value if Time field is populated

vixenmyrtle

New Member
Joined
Jan 23, 2022
Messages
3
Office Version
  1. 2013
Platform
  1. Windows
Hi,
very basic question i'm sorry. but will need help for a simple formula to return a value if filed has time data on it. See table below.


Time InTIME IN
<Blank>No
05:00 AMYes
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
How about
Excel Formula:
=IF(ISNUMBER(A2),"Yes","No")
 
Upvote 0
You can use this if you want?

Excel Formula:
=IFERROR(IF(A1="","NO",IF(TIMEVALUE(TEXT(A1,"hh:mm:ss"))=A1, "YES", "NO")),"NO")

If the cell is blank or has invalid value, it will show NO. If it is a valid time then it will show YES.

1643031764037.png
 
Upvote 0
It depends on what might be in your column. If it is only time or blank or text then the given suggestions may well suit you. However, if other numerical data/formats might be in the column then they may return incorrect results - see samples below.
In column D I have suggested another option which picks up on those possible errors. Note though that CELL() is a volatile function so could impact your sheet performance if there is a very large number of these formulas.

vixenmyrtle.xlsm
ABCD
1Time InPost #2Post #3Post #5
2NoNONo
35:00 AMYesYESYes
4$0.36YesYESNo
50.2YesYESNo
6TextNoNONo
720%YesYESNo
81/08/2021YesNONo
912:33:15YesYESYes
1012:00YesYESYes
Sheet1
Cell Formulas
RangeFormula
B2:B10B2=IF(ISNUMBER(A2),"Yes","No")
C2:C10C2=IFERROR(IF(A2="","NO",IF(TIMEVALUE(TEXT(A2,"hh:mm:ss"))=A2, "YES", "NO")),"NO")
D2:D10D2=IF(AND(A2<>"",OR(CELL("format",A2)={"D6","D7","D8","D9"})),"Yes","No")
 
Upvote 0
Peter has raised a very important point.

vixenmyrtle, the formats can return unexpected results (Visually) with what you want. You need to undertsand how Excel stores time.

0 is 00:00:00, 0.25 is 6:00:00, 0.50 is 12:00:00, 1 is 23:59:00 (See the image below)

1643091636079.png


The underlying value of $0.36 is 0.36 which is a valid time and hence my formula gives a YES. It will not give a YES for $7.5 or for NOW() which is formatted as time.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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