Converting .csv into usable data

muhleebbin

Active Member
Joined
Sep 30, 2017
Messages
252
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2010
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Can someone assist in helping me turn a .csv export into something usable?

Currently the export has the following column headers:

Date​
Job​
Time In​
Time Out​
Cost Code​
Hours​
Earn Code​
Phase​
Status​

Within the Date column, there are names of our employees. For example row 2 is the employees name (rest of row is blank) and then rows 3-7 are date values and subsequent entries in the rest of the columns. The number of rows does vary employee by employee because they could be doing work for multiple jobs in a day. I'm trying to add a column a on sheet2 so that it brings in the employee name and then the rest of the values to create a pivot table.

Ultimately what i'm trying to do is find a specific Cost Code (PTO) under each employee, so if there's another way to look up under the rows of each employee the cost code PTO without doing the first ask, that would be most helpful!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi Muhleebbin,

If I'm understanding correctly your data looks like this:

Muhleellbbin.xlsx
ABCDE
1DateJobTime InTime OutCost Code
2John Doe
301-Jan-20A19:0017:00CC-A1
402-Jan-20X29:0019:24CC-X2
5Jane Smith
603-Jan-20Z79:0021:48CC-Z7
704-Jan-20W99:0021:45CC-W9
805-Jan-20A89:0021:42CC-A8
906-Jan-20XX9:0021:39CC-XX
10Bert Jones
1102-Feb-20K19:0021:48CC-K1
12
CSV


...but you want it like this:

Cell Formulas
RangeFormula
A2:A10A2=IF(ROW()-ROW($A$1)>COUNT(CSV!$A$2:$A$9999),"",INDEX(CSV!$A$2:$A$9999,AGGREGATE(14,6,ROW(CSV!$A$2:$A$9999)-ROW(CSV!$A$1)/((ISTEXT(CSV!$A$2:$A$9999)*(ROW(CSV!$A$2:$A$9999)<=AGGREGATE(15,6,ROW(CSV!$A$2:$A$9999)-ROW(CSV!$A$1)/(ISNUMBER(CSV!$A$2:$A$9999)),ROW()-ROW($C$1))))),1)))
B2:F10B2=IF(ROW()-ROW($A$1)>COUNT(CSV!$A$2:$A$9999),"",INDEX(CSV!A$2:A$9999,AGGREGATE(15,6,ROW(CSV!$A$2:$A$9999)-ROW(CSV!$A$1)/(ISNUMBER(CSV!$A$2:$A$9999)),ROW()-ROW($C$1))))
 
Upvote 0
Solution
Thank you very much!

You absolutely understood correctly and the solution worked perfectly!
 
Upvote 0
just for fum with Power Query (Get&Transform)
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Name = Table.FillDown(Table.AddColumn(Source, "Name", each try Text.Select([Date],{"a".."z","A".."Z"}) otherwise null),{"Name"}),
    Type = Table.TransformColumnTypes(Table.SelectRows(Name, each ([Job] <> null)),{{"Date", type date}, {"Time In", type time}, {"Time Out", type time}}),
    TSC = Table.SelectColumns(Type,{"Name", "Date", "Job", "Time In", "Time Out", "Cost Code"})
in
    TSC
DateJobTime InTime OutCost CodeNameDateJobTime InTime OutCost Code
John DoeJohnDoe01/01/2020A109:00:0017:00:00CC-A1
01/01/2020A10.3750.70833333CC-A1JohnDoe01/02/2020X209:00:0019:24:00CC-X2
01/02/2020X20.3750.80833333CC-X2JaneSmith01/03/2020Z709:00:0021:48:00CC-Z7
Jane SmithJaneSmith01/04/2020W909:00:0021:45:07CC-W9
01/03/2020Z70.3750.90833333CC-Z7JaneSmith01/05/2020A809:00:0021:42:14CC-A8
01/04/2020W90.3750.90633333CC-W9JaneSmith01/06/2020XX09:00:0021:39:22CC-XX
01/05/2020A80.3750.90433333CC-A8BertJones02/02/2020K109:00:0021:48:00CC-K1
01/06/2020XX0.3750.90233333CC-XX
Bert Jones
02/02/2020K10.3750.90833333CC-K1
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top