Import and clean up a CSV file in Excel

LibreeaPEV

New Member
Joined
Jan 24, 2020
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have been provided with a csv output file (over which I have no control) to import into Excel/Power BI so I can report on it. this file is updated overnight and has hundreds of rows, so it is not practical to update it manually. Its structure is as follows:

[blank] URL Number of Vistors
01/01/2019
1 http:www.something.com 2
2 http:www.somethingelse.com 2
3 http:www.somethingmore.com 2
02/02/2019
1 http:www.something.com 2
2 http:www.somethingelse.com 2
3 http:www.somethingmore.com 2

I need it to be in a format something like

1 http:www.something.com 2 01/01/2020
2 http:www.somethingelse.com 2 01/01/2020
3 http:www.somethingmore.com 2 01/01/2020
1 http:www.something.com 2 01/01/2019
2 http:www.somethingelse.com 2 01/01/2019
3 http:www.somethingmore.com 2 01/01/2019

Any assistance would be gratefully received
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
try add Conditional Column for date
fill down
filter url column by date (year)

assumed date is in url column
 
Upvote 0
Thaks for the fast response. The Date and the reference number are in the same column unfortunately posting has changed the formatting. Screen shot attached...
 

Attachments

  • csv file to clean up.png
    csv file to clean up.png
    17.6 KB · Views: 6
Upvote 0
column with dates will be as Column1 in PQ Editor
so
change type to text for Column1
if Column1 contain / then Column1 else null
fill down
for Column1 filter - does not contain /
then set data type for each column as you wish

be aware Mon 13/01/2020 is not a date, this is the text in PQ
 
Upvote 0
Thanks for this - did really well to a point, in PQE I now have a new column with Dates and Null in - but couldn't see at which point where I add fill down and to My Steps are Import in PQE > Remove top tows Added additional column (image below) but no option to fill down to 0 If I use it from the transform tab - I get no change
 

Attachments

  • add a column.png
    add a column.png
    44.8 KB · Views: 4
Upvote 0
change type to text for Column1
Custom: if Column1 contain / then Column1 else null
select Custom column
fill down
for Column1 text filter - does not contain /
then set data type for each column as you wish

could you post whole M-code you did? use tags
tag.png
from post menu/ribbon
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,850
Members
449,194
Latest member
HellScout

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