Power Apps – How to sum up hours and minutes in text format
3 steps
Introduction:
We will build a set up on to add up text with the format HH:MM. The result will the total hours in HH:MM. Take note that the result is total time (e.g. 56:33) not a point in time (e.g. 12:45 AM)
Step 1:
Have the following set up:
- Text Input named TextInput1
- Text Input named TextInput2
- Text Label named Label1
Step 2:
Change the Default property of TextInput1 and TextInput2 to
""
Step 3:
Change the Text property of Label1 to
With({
FirstTextboxHour: First(Split(TextInput1.Text,":")).Value,
FirstTextboxMinute: Last(Split(TextInput1.Text,":")).Value,
SecondTextboxHour: First(Split(TextInput2.Text,":")).Value,
SecondTextboxMinute: Last(Split(TextInput2.Text,":")).Value
},
//Calculate Hours
FirstTextboxHour + SecondTextboxHour
+
RoundDown((FirstTextboxMinute + SecondTextboxMinute)/60,0)
& ":" &
//Calculate Minutes
Text(Mod((FirstTextboxMinute + SecondTextboxMinute),60) ,"00")
)
Conclusion:
Test the formula out by putting hours and minutes separated by colons(:) in the text box. You will see the summed up hours and minutes update on the text box
Last Updated: Feb 23, 2024
Need expert guidance on Power Apps?