VBA compare 2 lists and add missing info

anzer

Board Regular
Joined
Mar 5, 2015
Messages
67
Hello,

How would it be possible with VBA to compare 2 lists and make them match a certain format.
So basically, I export a CSV with tasks and stories. The stories can have multiple tasks (parent/child). I have Title, decided at the beginning of a project that has multiple stories (again parent/child)

Basically, we create a template of the project like this:
A is the ID of the project, the main title (B) has no ID and no type
B is the type which has story (always the name "story"), a story can have multiple task with multiple names (can be task, debug, meeting, etc)
C is the description which will contain first the main title (Brain Storm, Preparation and the description of the stpries and task)

The issue is when I upload a CSV file from the report, there will be more task and stories. How can I create a VBA that will for example add ID 13 below 12 and above 20.
The CSV that I upload only has stories and task (in order) so if my CSV has ID 13 with a new task created after the template, how can we add it in the right place.
I want to make sure it will be able to add it if the new task is in the middle of the sroty, the beginning or the last one. I would also want to be able to add full new stories with tasks.

Thank you sooo much!


IDTypeDescription
Brain Storm
10Story
11Task
12Task
20Story
21Task
22Task
23Task
Preparation
30Story
31Task
32Task
40Story
41Task
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
why cant you add the items , then sort? No vb.

Hello Ranman,

I have to compare this one I already with with a new CSv report which can have several hundreds of lines, comparing them and adding them one by one in the right position is time consuming

What I thought of doing is a VBA loop vlookup that would stop everytime the line is not exactly the same below the correct ID (so if my template goes from ID 12 to 20 and in my CSV I have ID 12,13 then 20, it would add a line, copy the ID 13 row then go to the next one until it reach the end of the data

Thank you
 
Upvote 0
Unfortunately I can't since the template has all the main titles and the CSV don't.
What I would be doing is put the 2 files in the same sheets so the template would be A,B,C and the CSV would be in F,G,H.
I would create a formula that compare the CSV file with the template in J and if the data is not the same, it would put a 1 and if it is the same it would leave it blank. If there is one 1, then the following data will all be 1. I would then have a macro copy the first 1 and insert a row below the last blank line and copy it from the first one to add the data at the right spot. Then it would loop the macro until the last 1 is done. The formulas would update everytime it adds a line to update the 1 and blanks

What do you think?
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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