JasonEnsor
Programmer
Hi Guys,
I'm looking for inspiration/help on a 'quick' project i have been asked to look at and was hoping to get some advice/help.
The Task: Each month a report is downloaded from our PeopleSoft Database in to an Excel report. The report holds information about student fees. Each report has the same headings
ID Item Type Sum Line Amt Acct Term Posted Descr Waiver Code
From this report a random number of students need to be selected based upon the value in Descr.
So if i had 10 Students whose Descr was Waiver 1000, and 5 Students whose Descr was Waiver 500. I might decide i want to see 10% of the students with Waiver 1000 and 2% with Waiver 500.
The % should be able to be set at runtime.
My Thoughts: So my initial thought is to grab the Descr column and populate a userform with the unique values, then for each value have an area for the user to populate the number of results they would like to recieve. I was thinking if i used a listview i could just populate the first column with the Descr and then in the second column show the overall % of the Descr item (i.e So if we had 100 Descr's and a particular one showed up only once it would be 1%) then on the 3rd column the user could input the number of results they wish to recieve. However i think ideally it would be good to be able to enter the number of results you want to recieve and then based upon the percentage numbers for each group for the vba to calculate how many that equates to for each group.
I would then pass the random rows selected to a temporary worksheet for the user to view/print/save etc..
Code I'm thinking about writing:
Creating the userform and the listbox shouldn't be an issue, my main problem i think is going to be getting the random lines of data based upon the Descr. I also think calculating the Percentage might be an issue. I'd assume i could count the rows of data in excel, then count each occurance of the Descr to calculate the Percentage. How would be best to do this?
Any Thoughts/Ideas would be appreciated. I'm not expecting to be given all the code i need to write, just a few pointers really.
Many Thanks As Always
J.
Regards
J.
I'm looking for inspiration/help on a 'quick' project i have been asked to look at and was hoping to get some advice/help.
The Task: Each month a report is downloaded from our PeopleSoft Database in to an Excel report. The report holds information about student fees. Each report has the same headings
ID Item Type Sum Line Amt Acct Term Posted Descr Waiver Code
From this report a random number of students need to be selected based upon the value in Descr.
So if i had 10 Students whose Descr was Waiver 1000, and 5 Students whose Descr was Waiver 500. I might decide i want to see 10% of the students with Waiver 1000 and 2% with Waiver 500.
The % should be able to be set at runtime.
My Thoughts: So my initial thought is to grab the Descr column and populate a userform with the unique values, then for each value have an area for the user to populate the number of results they would like to recieve. I was thinking if i used a listview i could just populate the first column with the Descr and then in the second column show the overall % of the Descr item (i.e So if we had 100 Descr's and a particular one showed up only once it would be 1%) then on the 3rd column the user could input the number of results they wish to recieve. However i think ideally it would be good to be able to enter the number of results you want to recieve and then based upon the percentage numbers for each group for the vba to calculate how many that equates to for each group.
I would then pass the random rows selected to a temporary worksheet for the user to view/print/save etc..
Code I'm thinking about writing:
Creating the userform and the listbox shouldn't be an issue, my main problem i think is going to be getting the random lines of data based upon the Descr. I also think calculating the Percentage might be an issue. I'd assume i could count the rows of data in excel, then count each occurance of the Descr to calculate the Percentage. How would be best to do this?
Any Thoughts/Ideas would be appreciated. I'm not expecting to be given all the code i need to write, just a few pointers really.
Many Thanks As Always
J.
Regards
J.