Calculate Expired Date with T in Date Format

Vgabond

Board Regular
Joined
Jul 22, 2008
Messages
197
Hi MrExcel Guru

Seeking for your assistance as I have more than 100 csv files in a folder that I need to do the following :
1. Count row that have Expired Date. Date format is YYYY-MM-DDTHH:MM:SS. Then write the count of rows ( expired date) in a new sheet : Summary Expired Date
2. Write the file name in sheet: Summary Expired Date

Any assistance is appreciated
 
Yes. Any date in the column O that is less than the day the query is run.

Hi @Vgabond,

try this:

Power Query:
let
    Data = {"C:\PQ", "O"}, // to be updated with folder location and column letter with dates
    Process = Table.TransformColumns(
                    Table.SelectColumns(Folder.Files(Data{0}), {"Name","Content"}), 
                    {"Content", 
                        (x)=> let y = Table.ToColumns(Csv.Document(x,[Encoding=1200])){List.PositionOf({"A".."Z"}, Data{1})} 
                        in List.Count(
                            List.Select(
                                List.Transform(y , (x)=> Date.FromText(Text.BeforeDelimiter(x,"T"))),
                            each _ < DateTime.Date(DateTime.LocalNow())))
                    }
                        ),
    #"Rename Col" = Table.RenameColumns(Process, List.Zip({Table.ColumnNames(Process), {"Csv Name", "Expired dates count"}}))
in
    #"Rename Col"

Regards,
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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