Solved

How to convert a textfile to a pivottable that shows summary by the hour?

Posted on 2014-09-24
5
105 Views
Last Modified: 2014-09-24
Hi Experts

I have a textfile, that I need to import to Excel, and extract specific data to a pivottable. Unfortunately I do not receive the the specification in a way, that gives me the time in a way that Works for me.

The textfile states Time as 102345 which corresponds to 10:23:45.
I thought I could convert that by using this formula:
=IF(LEN(C4)=5;LEFT(C4;1)&":"&MID(C4;2;2)&":"&RIGHT(C4;2);LEFT(C4;2)&":"&MID(C4;3;2)&":"&RIGHT(C4;2)) and format this to a time format.

In my import it seems to Work fine, but when I import to a pivottable and wants to Group by the hour, I get the error that it is not possible to Group these data.

I have the time from the text file in column C and my calculated time in column U.

Any solutions on how to solve the problem, so I can get my hourly pivottable

best regards

Jørgen
Importtest.xlsx
0
Comment
Question by:Jorgen
  • 3
  • 2
5 Comments
 
LVL 32

Expert Comment

by:Rob Henson
ID: 40341319
Your formula is converting the time to a string of text that happens to look like a time. Enclose the formula in a TIMEVALUE formula:

=TIMEVALUE(IF(LEN(C4)=5;LEFT(C4;1)&":"&MID(C4;2;2)&":"&RIGHT(C4;2);LEFT(C4;2)&":"&MID(C4;3;2)&":"&RIGHT(C4;2)))

This will then convert it to a true time.

Thanks
Rob H
0
 
LVL 32

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 40341327
Also shorter formula for you for dealing with 5 or 6 digits:

=TIMEVALUE(LEFT(TEXT(C2,"000000"),2)&":"&MID(TEXT(C2,"000000"),3,2)&":"&RIGHT(TEXT(C2,"000000"),2))

The TEXT(C2,"000000") forces it to 6 digits if it isn't already.

Thanks
Rob H
0
 
LVL 4

Author Closing Comment

by:Jorgen
ID: 40341476
Hi Rob,

It just worked exactly like I wanted it to. I just generated a report in 5 minutes, that we have been waiting for in the last couple of years

Thanks

Jørgen
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 40341520
Even shorter still using only numeric functions:

=TIME(INT(C2/10000),INT((C2-INT(C2/10000)*10000)/100),C2-FLOOR(C2,100))

Thanks
Rob H
0
 
LVL 4

Author Comment

by:Jorgen
ID: 40342454
Works as well, and always nicer with shorter formulas.

Regards

Jørgen
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question