filter VBA to show only from the list

auzanoo

Board Regular
Joined
Jan 6, 2020
Messages
63
Office Version
  1. 2007
Platform
  1. Windows
dear experts,

could i get a vba code for this problem?

i have a list of movie titles:
Movie Summary.xlsx
A
1TITLE
2YOU
35 MAN: RISE OF THE ZOMBIES
4DO NOT ENTER
5HOTLINE 666
6HATTRICK
List


and i have raw data:
Movie Summary.xlsx
ABCDEFGHIJKLMN
1MarketTargetNon
2AllTotalNon
3CounterDescription (grouped)YearChannelDay of weekDateTimeABCDEFG
416V YOU2015CSTVSunday29/11/201525:42:38 - 25:59:591860,412,20,43091060,1
52Summary 29/11/20151860,412,20,43091060,1
632018CSTVSaturday06/01/201812:33:53 - 13:58:326471,39,71,93.2561719,9
7414:02:09 - 15:06:516321,39,81,92.4491725,8
85Summary 06/01/20186401,39,71,92.9071722,4
966K HOTLINE 6662015WTVThursday01/01/201509:56:12 - 11:05:049861,912,83,14.5321521,8
10711:05:05 - 11:10:018671,614,72,23.1481927,6
11711:10:01 - 11:56:151.1912,315,43,23.6211532,9
128Summary 01/01/20151.0682,113,93,24.1661526,2
1396V WHY ALWAYS ME2017BTVFriday06/10/201712:48:47 - 14:43:418061,511,62,43.9102420,6
1410Summary 06/10/20178061,511,62,43.9102420,6
15116I HATTRICK2019NTVTuesday07/05/201902:00:00 - 02:12:597261,510,32,11.8731338,8
161225:42:38 - 25:59:597511,510,92,12.2121933,9
1713Summary 07/05/20197421,510,72,12.0871735,7
Raw



and i want to be like this:
Movie Summary.xlsx
ABCDEFGHIJKLMNO
1
2MOVIE SUMMARY
3All Demographics
4
5No.TitleTahun RilisChnDayDateTimeABCDEFG
616V YOU2015CSTVSunday29/11/201525:42 - 25:591860,412,20,43091060,1
76V YOU2018CSTVSaturday06/01/201812:33 - 15:066401,39,71,92.9071722,4
826V HOTLINE 6662015WTVThursday01/01/201509:56 - 11:561.0682,113,93,24.1661526,2
936I HATTRICK2019NTVTuesday07/05/201902:00 - 02:127261,510,32,11.8731338,8
106I HATTRICK2019NTVTuesday07/05/201925:42 - 25:597511,510,92,12.2121933,9
11
Summary
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G10Cell ValueduplicatestextNO
G8Cell ValueduplicatestextNO
G7Cell ValueduplicatestextNO
G7Cell ValueduplicatestextNO
G6Cell ValueduplicatestextNO
G11:G1048576,G5:G6Cell ValueduplicatestextNO
G9Cell ValueduplicatestextNO



notes:
1. i just want to show the data from the movie list
2. the raw data movie title has a code
3. if the time is split, must be merged and use summary date (the blue one) ex: hotline 666
4. but if they split too long (more than one hour), keep them separated and ignore summary date ex: hattrick
5. format time from hh:mm:ss to hh:mm


big thanks if you could help this out. cause the real data has so many lists?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi,

Transforming your data might be easier in Power Query

Book1
ABCDEFGHIJKLMN
1CounterDescription (grouped)YearChannelDay of weekDateTimeABCDEFG
216V YOU2015CSTVSunday29/11/201525:42 - 25:591860.412.20.43091060.1
336V YOU2018CSTVSaturday6/01/201812:33 - 13:586471.39.71.93,2561719.9
446V YOU2018CSTVSaturday6/01/201814:02 - 15:066321.39.81.92,4491725.8
566K HOTLINE 6662015WTVThursday1/01/201509:56 - 11:059861.912.83.14,5321521.8
676K HOTLINE 6662015WTVThursday1/01/201511:05 - 11:108671.614.72.23,1481927.6
776K HOTLINE 6662015WTVThursday1/01/201511:10 - 11:561,1912.315.43.23,6211532.9
896V WHY ALWAYS ME2017BTVFriday6/10/201712:48 - 14:438061.511.62.43,9102420.6
9116I HATTRICK2019NTVTuesday7/05/201902:00 - 02:127261.510.32.11,8731338.8
10126I HATTRICK2019NTVTuesday7/05/201925:42 - 25:597511.510.92.12,2121933.9
Sheet2


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type any}, {"Column2", type text}, {"Column3", type any}, {"Column4", type text}, {"Column5", type text}, {"Column6", type any}, {"Column7", type text}, {"Column8", type any}, {"Column9", type any}, {"Column10", type any}, {"Column11", type any}, {"Column12", type any}, {"Column13", type any}, {"Column14", type any}}),
    #"Removed Top Rows" = Table.Skip(#"Changed Type",2),
    #"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
    #"Filtered Rows" = Table.SelectRows(#"Promoted Headers", each [Time] <> null and [Time] <> ""),
    #"Filled Down" = Table.FillDown(#"Filtered Rows",{"Description (grouped)", "Year", "Channel", "Day of week", "Date"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Filled Down",{{"A", type number}, {"B", type number}, {"C", type number}, {"D", type number}, {"E", type number}, {"F", type number}, {"G", type number}, {"Date", type date}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type1", "Time", Splitter.SplitTextByEachDelimiter({" - "}, QuoteStyle.Csv, false), {"Time.1", "Time.2"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Time.1", type text}, {"Time.2", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type2", "Time.1", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Time.1.1", "Time.1.2", "Time.1.3"}),
    #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter1",{"Time.1.3"}),
    #"Merged Columns" = Table.CombineColumns(#"Removed Columns",{"Time.1.1", "Time.1.2"},Combiner.CombineTextByDelimiter(":", QuoteStyle.None),"Merged"),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Merged Columns", "Time.2", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Time.2.1", "Time.2.2", "Time.2.3"}),
    #"Removed Columns1" = Table.RemoveColumns(#"Split Column by Delimiter2",{"Time.2.3"}),
    #"Merged Columns1" = Table.CombineColumns(#"Removed Columns1",{"Time.2.1", "Time.2.2"},Combiner.CombineTextByDelimiter(":", QuoteStyle.None),"Merged.1"),
    #"Merged Columns2" = Table.CombineColumns(#"Merged Columns1",{"Merged", "Merged.1"},Combiner.CombineTextByDelimiter(" - ", QuoteStyle.None),"Merged.2"),
    #"Renamed Columns" = Table.RenameColumns(#"Merged Columns2",{{"Merged.2", "Time"}})
in
    #"Renamed Columns"
 
Upvote 0
Hi,

Transforming your data might be easier in Power Query

Book1
ABCDEFGHIJKLMN
1CounterDescription (grouped)YearChannelDay of weekDateTimeABCDEFG
216V YOU2015CSTVSunday29/11/201525:42 - 25:591860.412.20.43091060.1
336V YOU2018CSTVSaturday6/01/201812:33 - 13:586471.39.71.93,2561719.9
446V YOU2018CSTVSaturday6/01/201814:02 - 15:066321.39.81.92,4491725.8
566K HOTLINE 6662015WTVThursday1/01/201509:56 - 11:059861.912.83.14,5321521.8
676K HOTLINE 6662015WTVThursday1/01/201511:05 - 11:108671.614.72.23,1481927.6
776K HOTLINE 6662015WTVThursday1/01/201511:10 - 11:561,1912.315.43.23,6211532.9
896V WHY ALWAYS ME2017BTVFriday6/10/201712:48 - 14:438061.511.62.43,9102420.6
9116I HATTRICK2019NTVTuesday7/05/201902:00 - 02:127261.510.32.11,8731338.8
10126I HATTRICK2019NTVTuesday7/05/201925:42 - 25:597511.510.92.12,2121933.9
Sheet2


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type any}, {"Column2", type text}, {"Column3", type any}, {"Column4", type text}, {"Column5", type text}, {"Column6", type any}, {"Column7", type text}, {"Column8", type any}, {"Column9", type any}, {"Column10", type any}, {"Column11", type any}, {"Column12", type any}, {"Column13", type any}, {"Column14", type any}}),
    #"Removed Top Rows" = Table.Skip(#"Changed Type",2),
    #"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
    #"Filtered Rows" = Table.SelectRows(#"Promoted Headers", each [Time] <> null and [Time] <> ""),
    #"Filled Down" = Table.FillDown(#"Filtered Rows",{"Description (grouped)", "Year", "Channel", "Day of week", "Date"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Filled Down",{{"A", type number}, {"B", type number}, {"C", type number}, {"D", type number}, {"E", type number}, {"F", type number}, {"G", type number}, {"Date", type date}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type1", "Time", Splitter.SplitTextByEachDelimiter({" - "}, QuoteStyle.Csv, false), {"Time.1", "Time.2"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Time.1", type text}, {"Time.2", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type2", "Time.1", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Time.1.1", "Time.1.2", "Time.1.3"}),
    #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter1",{"Time.1.3"}),
    #"Merged Columns" = Table.CombineColumns(#"Removed Columns",{"Time.1.1", "Time.1.2"},Combiner.CombineTextByDelimiter(":", QuoteStyle.None),"Merged"),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Merged Columns", "Time.2", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Time.2.1", "Time.2.2", "Time.2.3"}),
    #"Removed Columns1" = Table.RemoveColumns(#"Split Column by Delimiter2",{"Time.2.3"}),
    #"Merged Columns1" = Table.CombineColumns(#"Removed Columns1",{"Time.2.1", "Time.2.2"},Combiner.CombineTextByDelimiter(":", QuoteStyle.None),"Merged.1"),
    #"Merged Columns2" = Table.CombineColumns(#"Merged Columns1",{"Merged", "Merged.1"},Combiner.CombineTextByDelimiter(" - ", QuoteStyle.None),"Merged.2"),
    #"Renamed Columns" = Table.RenameColumns(#"Merged Columns2",{{"Merged.2", "Time"}})
in
    #"Renamed Columns"

i don't know this thing is existing. thank you so much, Mr. RasGhul!
 
Upvote 0

Forum statistics

Threads
1,214,874
Messages
6,122,034
Members
449,061
Latest member
TheRealJoaquin

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