Automatically create a duplicate excel file and delete its content

ted1234

New Member
Joined
Jun 16, 2017
Messages
2
I am exporting an excel file from a software, and the following is the picture of it:
Here for some fruits there is both In and Out where 1 represents In and 0 represents Out.
Here is what I want to have: 1) Delete all the rows the first two times they appear for a particular fruit. For ex: Orange is being let In (1) and let Out (0), which means we are good on that. Same goes for every other fruit. Now, another case is Apple, which is let In (1) twice, and let Out (0) only once. Here only delete the first In (1) and the first Out (0) for Apple. And finally in the case of Watermelon, nothing needs to be done because it has only been let In (1). Same three conditions apply for all the fruits.
2) Now what I talked about in step 1 needs to be done in another file. So, when this file is exported, it automatically creates a copy of itself, and inside that copy, everything I mentioned in step 1 is done.
The final result in that copied file will look like the image below:
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,214,628
Messages
6,120,618
Members
448,973
Latest member
ChristineC

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