AutoSum Cells above Active Cell and other stuff...

railanc4309

New Member
Joined
Feb 23, 2011
Messages
1
Hi All,

After doing a fair bit of 'googling' on this, i'm still really none-the-wiser on how to do what I want to do... So here I am!

I have a spreadsheet that contains several hundred rows of information like the example below:

startsas.jpg


Please note - these images are an example only, but the idea of what I want to do is still the same...

Where the rows contain the words 'double', I want to merge those two rows together (sum the numbers, and just keep one of the rows containing the ID, name and date etc.)

So, I want to position my cursor on cell A3 and insert a new row below the active cell.
I want to sum the numbers 2 cells above the active rows D2:D3, E2:E3, F2:F3 etc...) I also want to copy the other cells from the row above and bring them to be on the same line as my sums. (Highlighted in Yellow here to show you what I mean,)

mergedoublecells.jpg


So this bit needs to be fluid - in that wherever I position my cursor it will insert a row, sum 2 cells above (2 cells only!), and copy other lines from the row above and bring them down...

Once i've done that, I want to copy/paste as values so my sum's are now gone, and then remove the 'double' rows...

removedoubleentries.jpg


Finally, remove all blank spaces, and I'm left with a finished sheet of merged data.

finishedresults.jpg


In my 'real' spreadsheet, the columns aren't the same, I've just used these an example, but I'm hoping I can work out the rest once I've seen a bit of code...

I've got as far as inserting a line below the active cell, and I thought I had a bit of script that performed a 'sum' on the two cells above it, but alas - it's just not doing it!!

Any information anyone could give me would be really greatly appreciated... At the moment, i'm manually doing this work in my macros, which means i'm repeating the actions that I KNOW will be possible to do within another macro - I just don't know how!

Many thanks in advance,

Rachael
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
A hint would be to put the sum of the values directly into the cell, rather than creating a formula in the new row ... as you will be deleting the contributory cells anyway. Like :
Code:
cell_for_sum.Value=cell_for_sum.Offset(0,-1).Value + cell_for_sum.Offset(0,-2).Value
replacing cell_for_sum with whatever expression or object you have to reference the cell where the sum is to go.
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,473
Members
452,915
Latest member
hannnahheileen

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