Hello,
I have two columns of data, column A has purchases and column B has sales. I'm trying to create a macro that will continually sum the values across columns A and B until the sum becomes 0, then, the remainder of the sales are recorded onto column C. And when 0 has been reached, all the other sales are moved to column C until there are purchases to count again. So it will look like below:
Original data
A B C 1 2760 2 1980 3 3220 4 -2450 5 -5550 6 -4670 7 -9330 8 3450 9 9200 10 2420 11 -47454
End result
A B C 1 2760 2 1980 3 3220 4 -2450 5 -5510 -40 6 -4670 7 -9330 8 3450 9 9200 10 2420 11 -15070 -32384
I've searched on this forum and other forums as well and this FIFO code kind of works, except I cannot get the sumIn to take the sum of A1:A3 before adding B4.
I have tried to code in a range, but excel won't accept it, and I assume it is because this is an array. I am not familiar with arrays so I am unsure how to fix the code. I believe this is the line that needs to be changed:
Any pointers would be greatly appreciated!sumIn = a(ii, 1)
Bookmarks