Merging Columns based on two criteria

puppy26

New Member
Joined
Feb 23, 2012
Messages
42
Dear all,.
I'm fairly new to VBA programming.

I would like to merge 7 columns if two conditions are meet.

Start Week Ending week Jan Feb Mar Apr May Jun July Aug Sept Oct Nov Dec
7 11
7 11 12
1 53 1
1 53 1




If the values in the column A is 1 and column B is 53, I want to merge the columns C3 to N3

If the values in the column A is 7 and column B is 11, I want to merge the columns D2 to E2

Is it feasible using VBA programming or Do I have any functions??

Please do help me.

Many thanks!

Regards,
Puppy​
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Flashbond,
Just to give you more information, the number distribution in the columns are based on weeks. If the value in the start week is between 1-4, the merging should start from January. If the value starts from 5-7, it should merge from February and similiarly, if the End week number is 53, it should merge till December and if the End week number is 44, it should merge till October.

So if the start week is 1 and End week is 44, the merging should start from Jan to October and should be one cell as the output with the value to be shown in the middle.​
 
Upvote 0
Yeah exactly. As mentioned earlier, in the above case, the value of start week is 1 and end week is 53, the merging should be from January to December and output should be one cell with showing value in the centre of the merged cell..

Just to give one more example.. If the start value is 5 and end week is 44, the merging should be from February to October.. Hope I'm clear now :)
 
Upvote 0
Starting WeekEnding weekJanFebMarAprMayJunJulyAugSeptOctNovDec
1532.00%
1314 6.00%
1417 10.00%
1921 6.00%
2325 -3.50%
2829 -2.00%
2940 7.00%
3234 -3.00%
3639 -3.00%

<COLGROUP><COL style="WIDTH: 54pt; mso-width-source: userset; mso-width-alt: 2633" width=72><COL style="WIDTH: 53pt; mso-width-source: userset; mso-width-alt: 2596" width=71><COL style="WIDTH: 48pt" span=12 width=64><TBODY>
</TBODY>
 
Upvote 0
In the above example, if the start week is 1 and end week is 53, the columns should be merged from Jan to Dec as one cell and 2% should be at the centre.

if the start week is 29 and end week is 40, the columns should be merged from July to October as one cell and 7% should be at the centre of the merged cell.
 
Upvote 0
Sorry for a lot of questions. I am just trying to make it clear. What do you mean by merge? Summing percentages or display like "2.0%, 7.0%" in one cell?

EDIT: Ahaa! Only starting week value should be left in the center of merged cells!!! Ok give me a minute.
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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