VBA - Layout and sorting with conditions

BorisTheCat84

New Member
Joined
Apr 30, 2021
Messages
17
Office Version
  1. 2019
Platform
  1. Windows
Hi Team,

I'm facing the current scenario, I will start by placing the sheet that i'm working in and then bring up what has to be done:
Mr.Excel.xlsx
ABCDEFGHIJKL
1
2UUIDWhatsover1Whatsover2Whatsover3Whatsover4Whatsover5Whatsover6Whatsover7Whatsover8Whatsover9Adjust and filterWhatsover10
3140542WhatsoverWhatsoverWhatsoverWhatsoverWhatsover5/20/2021 10:00:00 AM5/20/2021 7:00:00 PMScheduledWhatsover3-Moderate/Limited
4WhatsoverWhatsoverWhatsoverWhatsoverOrangevrqm is great for taste
5WhatsoverWhatsoverWhatsoverWhatsoverOrangevrqm is really good
6WhatsoverWhatsoverWhatsoverWhatsoverOrange has good result
7Orange is really good
8OrangeVMGT0 are everywhere
9Orange is in my house
10Blueberry is really good
11Blueberry is really good.Blueberry is delicous
12BlueberryVMGT0 is really good.Blueberry is delicous1
13Blueberry is really good.Blueberry is delicous2
14Blueberry is reallyVMGT0 good.Blueberry is delicous3
15Blueberry is really good.Blueberry is delicous4
16Blueberry is really good.Blueberry is delicous5
17140555Whatsover5/20/2021 1:00:00 PM5/20/2021 3:00:00 PMDraftWhatsoverOrange is really good3-Moderate/Limited
18Orangeiwfm0 has good result
19Orange are everywhere
20140888Whatsover5/20/2021 1:00:00 PM5/20/2021 3:00:00 PMDraftWhatsoverOrangeiwfm0 is really good3-Moderate/Limited
21Orange has good result
22Orangeiwfm0 is really good
23May 20, 2021 8:35 AM
Sheet1


So Mainly a cleanup should be done in Column K:K respecting each UUID (in such not to apply the same condition on cells that belongs to the second UUID) according to the following criteria:
1- Clear Duplicates in the column
2- Clear all cells where "vrqm" or "VMGT0" or "wfm0" is not found in any word inside the cell // (note i have more but i will add them myself)
3- Shift cell up to avoid empty cells
4- Shift cell up in case the cell that matches the UUID is empty
5- Delete Empty Rows

Once that is done we will have to work on the entire table to properly format it, we will mainly need to merge empty cells in each column till they reach the line before the next UUID starts.
Finally, last task will be to merge and center the last row.

The expected output should be as follow:
UUIDWhatsover1Whatsover2Whatsover3Whatsover4Whatsover5Whatsover6Whatsover7Whatsover8Whatsover9Adjust and filterWhatsover10
140542WhatsoverWhatsoverWhatsoverWhatsoverWhatsover5/20/2021 10:00:00 AM5/20/2021 10:00:00 AMScheduledWhatsoverOrangevrqm is great for taste3-Moderate/Limited
WhatsoverWhatsoverWhatsoverWhatsover5/20/2021 10:00:00 AM5/20/2021 10:00:00 AMOrangevrqm is really good
WhatsoverWhatsoverWhatsoverWhatsoverOrange is really goodwfm0
WhatsoverWhatsoverWhatsoverWhatsoverOrangeVMGT0 are everywhere
BlueberryVMGT0 is really good.Blueberry is delicous
Blueberry is reallyVMGT0 good.Blueberry is delicous3
140555WhatsoverWhatsoverWhatsoverWhatsoverWhatsover5/20/2021 1:00:00 PM5/20/2021 3:00:00 PMDraftWhatsoverOrange is reallywfm0 good3-Moderate/Limited
Orangeiwfm0 has good result
140888WhatsoverWhatsoverWhatsoverWhatsoverWhatsover5/20/2021 1:00:00 PM5/20/2021 3:00:00 PMDraftWhatsoverOrangeiwfm0 is really good3-Moderate/Limited
WhatsoverWhatsoverWhatsoverWhatsover5/20/2021 1:00:00 PM5/20/2021 3:00:00 PM
May 20, 2021 8:35 AM


I would appreciate if you guys could help me with the VBA Code.

Cheers!
Boris
 
I think that you mis-understood what I was asking. Your original data in post #9 is shown in the range A2:L26.
Your expected results do not show rows or columns. Are they in A2:L13 (approx) in the same worksheet or in, say Y2:AJ13 (approx) in the same worksheet or even on a different worksheet?"
Oh apologies to that, the result will be in A2:L13 (approx) in the same worksheet.
The main report can disappear, won't need it after the cleanup runs through the code
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Thanks for the additional clarification. I'm not sure that I will be able to help with this in the end but it still isn't clear anyway.

Why isn't BlueberryVMGT0 is really good.Blueberry is delicous1 in the expected results for UUID 140542?

How do UUIDs 140555 and 140888 get values in columns C:F in the expected results when they have no values in those columns in the original data?
 
Upvote 0
Thanks for the additional clarification. I'm not sure that I will be able to help with this in the end but it still isn't clear anyway.

Why isn't BlueberryVMGT0 is really good.Blueberry is delicous1 in the expected results for UUID 140542?

How do UUIDs 140555 and 140888 get values in columns C:F in the expected results when they have no values in those columns in the original data?
Hi Peter,
BlueberryVMGT0 is really good.Blueberry is delicous1 is in the expected results for UUID 140542 (i've checked it in the expected output and it's there)
How do UUIDs 140555 and 140888 get values in columns C:F in the expected results when they have no values in those columns in the original data? =>Whatsoever values we have for C:F we won't touch it, the objective is to merge the blank cells in the column, you can consider each "whatsoever" to be "whatsoeverX" with X a variable...

If you can't help, thank you for having tried && i would appreciate if you can assign it to someone that would be able to help finding out the code (VBA).
 
Upvote 0
Hi Peter,
BlueberryVMGT0 is really good.Blueberry is delicous1 is in the expected results for UUID 140542 (i've checked it in the expected output and it's there)
How do UUIDs 140555 and 140888 get values in columns C:F in the expected results when they have no values in those columns in the original data? =>Whatsoever values we have for C:F we won't touch it, the objective is to merge the blank cells in the column, you can consider each "whatsoever" to be "whatsoeverX" with X a variable...

If you can't help, thank you for having tried && i would appreciate if you can assign it to someone that would be able to help finding out the code (VBA).
After a double check i've noticed the BlueberryVMGT0 is really good.Blueberry is delicous3 is there but not the BlueberryVMGT0 is really good.Blueberry is delicous1 // i've added it :)
Thank you for your patience :), here we go again for the expected output:

Mr.Excel.xlsx
ABCDEFGHIJKL
1
2UUIDWhatsover1Whatsover2Whatsover3Whatsover4Whatsover5Whatsover6Whatsover7Whatsover8Whatsover9Adjust and filterWhatsover10
3140542WhatsoverWhatsoverWhatsoverWhatsoverWhatsover5/20/2021 10:00:00 AM5/20/2021 10:00:00 AMScheduledWhatsoverOrangevrqm is great for taste3-Moderate/Limited
4WhatsoverWhatsoverWhatsoverWhatsover5/21/2021 10:00:00 AM5/21/2021 10:00:00 AMOrangevrqm is really good
5WhatsoverWhatsoverWhatsoverWhatsoverOrange is really goodwfm0
6WhatsoverWhatsoverWhatsoverWhatsoverOrangeVMGT0 are everywhere
7BlueberryVMGT0 is really good.Blueberry is delicous
8BlueberryVMGT0 is really good.Blueberry is delicous1
9Blueberry is reallyVMGT0 good.Blueberry is delicous3
10140555WhatsoverWhatsoverWhatsoverWhatsoverWhatsover5/20/2021 1:00:00 PM5/20/2021 3:00:00 PMDraftWhatsoverOrange is reallywfm0 good3-Moderate/Limited
11Orangeiwfm0 has good result
12
13140888WhatsoverWhatsoverWhatsoverWhatsoverWhatsover5/20/2021 1:00:00 PM5/20/2021 3:00:00 PMDraftWhatsoverOrangeiwfm0 is really good3-Moderate/Limited
14WhatsoverWhatsoverWhatsoverWhatsover5/20/2021 1:00:00 PM5/20/2021 3:00:00 PM
15
16May 20, 2021 8:35 AM
Sheet2
 
Upvote 0
Whatsoever values we have for C:F we won't touch it, the objective is to merge the blank cells in the column, you can consider each "whatsoever" to be "whatsoeverX" with X a variable...
I didn't understand that. Don't we only merge rows within each UUID range of rows?
I would have thought that since the green and blue areas below have no data, then the results for those sections would have no data. Are you specifically saying that here cells C6:C22 (from UUID 140542 and 140555 and 140888) all get merged into one single merge area and similar for the other columns?

BorisTheCat84.xlsm
ABCDEFG
1
2UUIDWhatsover1Whatsover2Whatsover3Whatsover4Whatsover5Whatsover6
3140542WhatsoverWhatsoverWhatsoverWhatsoverWhatsover5/20/2021 10:00:00 AM
4WhatsoverWhatsoverWhatsoverWhatsover
5WhatsoverWhatsoverWhatsoverWhatsover
6WhatsoverWhatsoverWhatsoverWhatsover
7
8
9
10
11
12
13
14
15
16
17140555Whatsover5/20/2021 1:00:00 PM
18
19
20140888Whatsover5/20/2021 1:00:00 PM
21
22
23May 20, 2021 8:35 AM
Sheet1



i would appreciate if you can assign it to someone
Nobody "works" for the forum so there is no assigning of threads. It is a public forum and if anybody wants to help with a thread they can but there is no compulsion to do so. Still, you never know, somebody else might step in at any time.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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