i have an excel sheet and want to make some sums and write them in another new attribute

i want to sum row O from start to line above an attribute in row M wich is VU or VD...so e.g
sum 1 = light blue
sum 2 = light blue + dark blue and so on till the next line which is one above a line with VD or VU…...i hope i have explained it not to difficult…...i think the hard part for me is that i need always a sum from the beginning again
Thank you and greetz
franco