Link to home
Start Free TrialLog in
Avatar of activematx
activematxFlag for United States of America

asked on

Excel Macro to do some basic arithmetic.

Hi Excel Experts,

Take a look at this image here:
User generated image
Inside of Column L I have highlighted the cells of importance yellow.  I have also manually performed the function I need done without using a macro so you can see how I would like the output.

To the right of the first yellow cell 441 you will see three numbers (191, 100, 150).  

-Those values added up will equal 441.
-Those numbers came from column H.

Basically, I need to do the same for each set of numbers in this workbook.

I also did the second set 85 in this example, to give you a better idea of what needs done.

1.  Column L shows that we have 85, so this is what we need to get from column H (starting at the bottom).\
2.  The first one in Column H shows 81, so we need 4 more from the next row.

Can someone help me create this macro to perform these functions?  Thank you -- I have attached the workbook to this question.
Avatar of Bill Prew
Bill Prew

What about the "0" values in column L, just ignore those?

Avatar of activematx


What about the "0" values in column L, just ignore those?

Yes.   The ones that have a zero in it, don't need anything done to them.  Thanks for helping me with my problem!
I"m confused. You say the values in column M came from column H. But the values in column H are 200, 100, 150 -- not 191, 100, 150.

Also, I noticed column L is labeled 'On Hand'. Can I assume you're trying to get a count of each PLU in stock? If so, please see the attached file which achieves that result using simple sumif formula. If you are indeed trying get an inventory count of each PLU I would recommend this approach over a VBA approach. I try to do stuff like this without VBA. With that said, if you still want a VBA approach let me know. Or if I'm way off in understanding the problem let me know.

Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Thank you so much!  I really appreciate the help!  The hard part is over.   I will be posting the 2nd stage of this question tomorrow.  I would really appreciate if you could help me with my next question (much easier!).

I will post it tomorrow.  THank you so much!!!!