I'm looking for a formula that adds a colon to military time if the user hasn't entered one.
So B1 would have a formula that if A1 = 1113, B1 = 11:13, and if A1 = 11:13, B1 = 11:13
I'm looking for a formula that adds a colon to military time if the user hasn't entered one.
So B1 would have a formula that if A1 = 1113, B1 = 11:13, and if A1 = 11:13, B1 = 11:13
try this...
=IF(A1>1,(LEFT(A1,2)&":"&RIGHT(A1,2))*1,A1)
But you may want to look at using data validation to make sure they enter the data correctly in the 1st place?
You could use "decimal" <1
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
Well your formula worked perfect but your alternative was even better. Went with the data validation. Thanks!
Happy to help, and its always better to do it right, rather than figure out how to fix it![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks