Grammatically correct Arabic hours and minutes in Excel

I wanted to be able to take the difference between two times in Excel (extra time worked vs. time missed) and write a grammatically correct sentence indicating how many hours and/or minutes difference there was (either under or over).

Even in English, I dislike seeing interfaces that ignore singular or plural units (e.g. You have 0 hours and 1 minutes remaining). In Arabic, the units take either singular, dual, or plural tenses for 1,2, and 3-10 respectively, and then revert to a singular tense for numbers 11 and above.

In this example, cell D2 contains time missed, cell D3 contains extra time worked, and cell D4 contains the difference between the two times. Since negative time doesn’t work in Excel, we can compare the results of subtracting each time from the other and then keep the larger of the two results =MAX(D2-D3,D3-D2); assuming valid times are entered, this will always result in a positive time.

In another cell, we can then put together some IF statements and glue the results into a sentence using CONCATENATE:

If there are no hours, just minutes will display. If there are no minutes, just hours will display. If there are hours and minutes, they will both display with a linking “and”.

In order to support more than 24 hours, you can also replace HOUR(D4) with NUMBERVALUE(TEXT(D4, "[h]")).

Here’s an example with a deficit of 22 hours and two minutes:
Example of negative result

Here’s another example with exactly one minute extra:
Example of positive result

You can download a working demo here:
Excel formula (grammatical Arabic hours and minutes)

0 Comments

Add Yours →

Leave a Reply