Originally Posted by
LucasSp
Well after all of this confusion this actually worked really well for what I was trying to accomplish. I don't really understand how to formula works though could you take a few moments to explain it to me? Just curious on the way it functions. Also say I wanted to add another column that adds for another bin such as bin B - 1 and so on. Would this formula also work for that?
Edit:
Didn't realize the question was already answered about the sumproduct
I didn't even think of using sumproduct. If you want to see how it works, you can step through it under the formula tab click evaluate formula. Essentially it checks each the first 6 characters (a space is a character) against the 6 characters starting after bin. It returns an array of true/false results (which convert to 1 and 0 respectively. This is different in VBA) The *($D$8:$D$100) creates an array from D8 to D100 w/ the values inside and multiplies each row against the true or false and adds them at the end. So if it's false, it would output 0 and 0 * x is 0 and if it's 1 it just returns the value from D because 1 * x would just be x.
As for my code I put earlier, you would add the code below the doDate subroutine in the sheet1 (5) worksheet code. Then add the call to that new sub between the following like :
Bookmarks