Adding total hours with AM + PM

Hello. Currently within my board I am trying to create a function that takes input from different columns and gets the total hours

Columns are Monday start time Monday End time etc.

My problem is that I figured out how to make this happen but when it uses time that is presented at the same except am / pm it doesn’t find any difference when it should find 12 hours or 12.
Monday Start time is 8:00AM when Monday End Time is 8:00 PM. This gets a result of 0 instead of 12

My code is posted below:

MID(HOURS_DIFF({Monday End Time}, {Monday Start Time}),1,LEN(HOURS_DIFF({Monday End Time}, {Monday Start Time}))-3)+right(HOURS_DIFF({Monday End Time}, {Monday Start Time}),2)/60

@KyleT

It seems that the main issue is that the “hour” columns that you are using are text type columns instead of hour type columns.

If you make sure that both columns are true hour columns, you could simplify your formula to:

LEFT(HOURS_DIFF({Monday End Time}, {Monday Start Time}), 2) +
   RIGHT(HOURS_DIFF({Monday End Time}, {Monday Start Time}), 2) / 60

Jim - The Monday Man (YouTube Channel)
What is Make & How can it help you with monday?
We Create Custom Solutions - Your Make or Ours
Schedule a 1-on-1 Tutorial Session (for monday, Make or Excel)

I converted my columns to hours which greatly cleaned up my code.

My follow-up question is is if I was implementing a check that if the cell doesn’t contain a hour value it doesn’t crash my formula. I assume this would be accomplished with a if functions that outputs 0 instead of an error if no data is detected

@KyleT

It will depend on the integration writing the data. monday will not allow an errant value to be written. Any attempt in that regard will most likely write a blank value. The current formula will return 0 if either value is blank.

For anyone interested, here’s another way to do the formula:
TIMEVALUE("1/1/1 " & HOURS_DIFF({Monday End Time}, {Monday Start Time})) * 24


Jim - The Monday Man (YouTube Channel)
What is Make & How can it help you with monday?
We Create Custom Solutions - Your Make or Ours
Schedule a 1-on-1 Tutorial Session (for monday, Make or Excel)