strange bug (?) in Excel: I need to F2 + press ENTER to make the results of the formulas work

With the attached file, why do you need to edit (double click) the cell B2 and press ENTER to make the formula in cell F2 show the correct result (18:14:32)?

How can I fix the results in F all at once without editing and pressing ENTER on every single cell in B?


(tested on Excel 2010)
debug.xlsx
lucavillaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
Because column B is currently text, not a time. By going in cell B2 and pressing ENTER, it forces it to re-evaluate the cell and changes it to time.
 
To change them all at once, highlight column B, press Ctrl+H, and enter : in both the FIND and REPLACE. It will then replace a colon with a colon, which forces Excel to re-evaluate all those cells.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NorieVBA ExpertCommented:
B2 is a time stored as text, doing what you describe will convert it to a 'real' time.

If you want to convert all the values in that column copy a blank cell, select the values in column B, goto Paste>Paste Special and select Add from the Operation section.

That will fix the values but you'll lose the formatting but you can easily reapply that from column F with the format painter.
0
FarWestCommented:
I don't think changing format will  fix the problem

try this code
Public Sub fixtime()
Dim ii As Integer
For ii = 1 To ActiveSheet.UsedRange.Rows.Count
ActiveSheet.Cells(ii, 2).Value = ActiveSheet.Cells(ii, 2).Value
Next
End Sub

Open in new window

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Rob HensonFinance AnalystCommented:
In a spare column type formula

=TIMEVALUE(B2)

Copy down as required then copy and paste values into column B, reformat as time.

The same applies to the values in column D.

Thanks
Rob H
0
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
Ignore my earlier suggestion (even though it was right).
 
You also have to edit column D, so it’s easier to change the formula in F2 to:
 
=(NETWORKDAYS(A2,C2,{42005;42010})-1)*0.354166666666667+MIN(MAX(VALUE(D2),0.354166666666667),0.708333333333333)-MIN(MAX(VALUE(B2),0.354166666666667),0.708333333333333)
0
Rob HensonFinance AnalystCommented:
Or in the formula in F, wrap the references to B & D in TIMEVALUE function:

=(NETWORKDAYS(A2,C2,{42005;42010})-1)*0.354166666666667+(IF(TIMEVALUE(D2)<0.354166666666667,0.354166666666667,IF(TIMEVALUE(D2)>0.708333333333333,0.708333333333333,TIMEVALUE(D2)))-IF(TIMEVALUE(B2)<0.354166666666667,0.354166666666667,IF(TIMEVALUE(B2)>0.708333333333333,0.708333333333333,TIMEVALUE(B2))))

Thanks
Rob
0
Rob HensonFinance AnalystCommented:
Which looking at it again, is pretty much what Philip has done but has just used VALUE (which gives serial value of text time) and has used MIN/MAX functions to shorten the IF statements.

Thanks
Rob H
0
NorieVBA ExpertCommented:
What I suggested can be extended to the other column and by using that method, or similar, you end up with 'real' time values and don't need to change any formulas.
0
barry houdiniCommented:
I'm not going to answer your question (!) but if all reference values are true dates or times I'd suggest using this shorter formula using more recognisable time values

=(NETWORKDAYS(A2,C2,{42005;42010})-1)*("17:00"-"8:30")+MEDIAN(D2,"8:30","17:00")-MEDIAN(B2,"8:30","17:00")

Personally I would also replaced the holiday range with a cell reference which contains recognisable holiday dates

regards, barry
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.