Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9786

How to add a missing : to an input in Google sheet?

$
0
0

I'm trying to make a military time converter using slack workflows. It works by pulling up a form when they press the button in the channel.

It asks them one question.

What is the time in military time? (Format XX:XX)

Value then imports itself into a Google sheet and uses a different cell formatted for standard time.

The workflow system then reads the value of the two cells and puts them together into a text string.

Due to the limited nature of slack workflows. I cannot simply restrict they're inputs to only match my formatting so people are putting in things like.

1314 or 13, rather then 13:14 or 13:00. The issue is that the cellular input no longer reads as a time in the Google sheet meaning I'm getting returns like.

1314 is 12:00 am in standard time.

To solve this I used the replace function to add in the missing values.

=REPLACE(B3,3,0,":")

Or

=REPLACE(B3,3,0,":00")

Which works fine if they're entering in the text the incorrect format.

But if they enter the text in the format that the tool tells them to the system then errors out and gives the following return.

13::00 is 12:00 am in standard time.

I tried or search function to only fire the replace function if it's not formatted correctly but have been unsuccessful thus far getting errors like #value, #error, etc.

Before anybody asks unfortunately, I cannot make a slack application due to security restrictions and the cannot access sheets/excel for similar reasons. I've tried telling my co-workers that military time is super easy... If your number is greater than 12 subtract 12 and toss pm on it... I didn't go so well... I tried making them a PDF. Was literally a military conversion... The lost it. I literally had a co-worker call me on vacation because they were entering payroll and couldn't figure out what 20:31 was in military time... Any help would be greatly appreciated!


Viewing all articles
Browse latest Browse all 9786

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>