SOLVED

Formula to return value from text

Copper Contributor

 

 

I'm trying to create a schedule that auto generates time based on cell entries. I have everything working until I enter text into a cell to denote PTO, HOL,IN and OFF. My formula will no longer return a value. I can't figure out a way to either ignore the text and return a TIME 0:00 or give the text a TIME value.

 

S10 holds the formula for calculating TIME

 

=IF(C10-B10>TIME(5,0,0),C10-B10-TIME(0,30,0),C10-B10)+IF(E10-D10>TIME(5,0,0),E10-D10-TIME(0,30,0),E10-D10)+IF(G10-F10>TIME(5,0,0),G10-F10-TIME(0,30,0),G10-F10)+IF(I10-H10>TIME(5,0,0),I10-H10-TIME(0,30,0),I10-H10)+IF(K10-J10>TIME(5,0,0),K10-J10-TIME(0,30,0),K10-J10)+IF(M10-L10>TIME(5,0,0),M10-L10-TIME(0,30,0),M10-L10)+IF(O10-N10>TIME(5,0,0),O10-N10-TIME(0,30,0),O10-N10)

 

 

P10 reference S10 to calculate total hours

 

=TEXT(S10*24,"0.00")

 

 

Q10 references P10 to calculate overtime

 

=TEXT(IF(P10-40<0,0,P10-40),"0.00")

 

 

Going down each row the formulas are the same with the proper cells referenced for calculations.

Row 11 works fine because there no text. Row 10 does not work because of text "PTO"

Captnshacky_0-1682446835524.png

 

Any help would be greatly appreciated.

2 Replies
best response confirmed by Captnshacky (Copper Contributor)
Solution

@Captnshacky 

=IFERROR(IF(C10-B10>TIME(5,0,0),C10-B10-TIME(0,30,0),C10-B10),0)+IFERROR(IF(E10-D10>TIME(5,0,0),E10-D10-TIME(0,30,0),E10-D10),0)+IFERROR(IF(G10-F10>TIME(5,0,0),G10-F10-TIME(0,30,0),G10-F10),0)+IFERROR(IF(I10-H10>TIME(5,0,0),I10-H10-TIME(0,30,0),I10-H10),0)+IFERROR(IF(K10-J10>TIME(5,0,0),K10-J10-TIME(0,30,0),K10-J10),0)+IFERROR(IF(M10-L10>TIME(5,0,0),M10-L10-TIME(0,30,0),M10-L10),0)+IFERROR(IF(O10-N10>TIME(5,0,0),O10-N10-TIME(0,30,0),O10-N10),0)

 

You can try this formula.

Formula to return value from text.JPG

 

@OliverScheurich 

I wasn't even thinking in that direction.

You rock! Thank you

1 best response

Accepted Solutions
best response confirmed by Captnshacky (Copper Contributor)
Solution

@Captnshacky 

=IFERROR(IF(C10-B10>TIME(5,0,0),C10-B10-TIME(0,30,0),C10-B10),0)+IFERROR(IF(E10-D10>TIME(5,0,0),E10-D10-TIME(0,30,0),E10-D10),0)+IFERROR(IF(G10-F10>TIME(5,0,0),G10-F10-TIME(0,30,0),G10-F10),0)+IFERROR(IF(I10-H10>TIME(5,0,0),I10-H10-TIME(0,30,0),I10-H10),0)+IFERROR(IF(K10-J10>TIME(5,0,0),K10-J10-TIME(0,30,0),K10-J10),0)+IFERROR(IF(M10-L10>TIME(5,0,0),M10-L10-TIME(0,30,0),M10-L10),0)+IFERROR(IF(O10-N10>TIME(5,0,0),O10-N10-TIME(0,30,0),O10-N10),0)

 

You can try this formula.

Formula to return value from text.JPG

 

View solution in original post