Need help with a time formula, something custom for sure...

dmanx1120

New Member
Joined
Sep 27, 2017
Messages
3
So im currently using 0\:00 so I can just type 706 and it changes it to 7:06. How can I make it add 12 (military time basically) so that when I type 706 it will generate 19:06.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
or if I type something like 706+ it knows its military time or adds "12 or 12:00". Any help is appreciated! thanks.
 
Upvote 0
Right click on the cell that you will be typing the time into and click 'format cells' > click 'time' on the left panel > click the military time option (it should show up as 13:30:00 or something similar). Hit ok. Clear the cell and type a time - it will work!
 
Upvote 0
So im currently using 0\:00 so I can just type 706 and it changes it to 7:06. How can I make it add 12 (military time basically) so that when I type 706 it will generate 19:06.

Using this method, how would you tell the difference between AM or PM when entering 706?
 
Upvote 0
I see what you are trying to do. A bit more complicated, but give this a shot. Let's say that you type all of the times in column A, starting in cell A1. Keeping with your example, let's say 706 is am and 706+ is pm.

In cell B1 - Type the following formula and hit CTRL + SHIFT + ENTER
=IF(RIGHT(A1,1)="+",SUMPRODUCT(MID(0&A1,LARGE(INDEX(ISNUMBER(--MID(A1,ROW(1:25),1))*ROW(1:25),0),ROW(1:25))+1,1)*10^ROW(1:25)/10)+1200,SUMPRODUCT(MID(0&A1,LARGE(INDEX(ISNUMBER(--MID(A1,ROW(1:25),1))*ROW(1:25),0),ROW(1:25))+1,1)*10^ROW(1:25)/10))

Right click cell B1 and put it in the custom time format that you are currently using, 0\:00. Drag the formula down column B. Let me know if this works.
 
Upvote 0
Actually - I forgot to lock the cells so it would result in an error when you tried to drag it down column b! Use this formula instead:

=IF(RIGHT($A1,1)="+",SUMPRODUCT(MID(0&$A1,LARGE(INDEX(ISNUMBER(--MID($A1,ROW($1:$25),1))*ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)+1200,SUMPRODUCT(MID(0&$A1,LARGE(INDEX(ISNUMBER(--MID($A1,ROW($1:$25),1))*ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10))
 
Upvote 0
Could you some how use 706+ to let the computer know to generate military time? So if I typed 706 = 7:06 and 706+ = 19:06

I suppose you could use something like,

=IF(RIGHT(A1,1)="x",TEXT(SUBSTITUTE(A1,"x",""),"00\:00")+0+1/2,TEXT(A1,"00\:00")+0)

but ideally, teach the users military time. You can still Custom Format the cell so entering colons wouldn't be necessary.
 
Upvote 0

Forum statistics

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