Formula to extract data according to dates

yudadude

New Member
Joined
Nov 24, 2017
Messages
1
Need a solution, Need to sort local election results, I have one column with the voting history dates for each registered voter for several years, I’m trying break up the voting dates to able to see which voter voted in which election/year, each date is separated with a semicolon in the same cell, see below example,Row 1 has, 20161108 GE;20131105 GE;20130910 PR;20121106 GE;20101102 GERow 2 has,20170912 PR;20161108 GE;20160913 PR;20141104 GE;20131105 GE;20130910 PR;Row 3 has,20161108 GE;20120320 SP;20081104 GE;General Election 2005;General Election 2004I’m looking for a formula that will do text to column and leave blank cells for the missing years, so that column B will have all the 2017 dates column C will have all 2016 dates, so that column D will have all the 2015 dates.note: date are left to right, high to lowPlease let me know if you have a solution for me,thank you very much
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Excel has a built in tool on the Data Tab called Text to Columns. That function will separate your data into individual columns much like importing a CSV delimited file.
However, that function cannot give you the second part of your request which is to put the data in specific columns based on year.
There are many experts on this forum that do amazing things with existing Excel functions that may be able to solution that part of your request.

For me, I could provide a solution via a VBA code module.
 
Upvote 0
Try this. First enter the numbers in bold (years) in row 1. Then enter the formula in C2, then draw it down and across. Data in 2005 and before should be conversed before this processing. It is assumed that there are only two elections in the same year.

Excel Workbook
ABCDEFGH
1NAME201720162015201420132012
2x.Y.20161108 GE;20131105 GE;20130910 PR;20121106 GE;20101102 GE; 20161108 GE;20131105 GE;20130910 PR;20121106 GE;
3Z.Q.20170912 PR;20161108 GE;20160913 PR;20141104 GE;20131105 GE;20130910 PR;20170912 PR;20170912 PR;20170912 PR;20161108 GE;20160913 PR;20141104 GE;20141104 GE;20131105 GE;20130910 PR;
4P:S:20161108 GE;20120320 SP;20081104 GE;General Election 2005;General Election 2004;20161108 GE;20120320 SP;20120320 SP;
5Y.L.20170912 PR;20161108 GE;20160913 PR;20141104 GE;20131105 GE;20130910 PR20170912 PR;20161108 GE;20160913 PR;20141104 GE;20141104 GE;20131105 GE;20131105 GE;
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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