Hi All,
I started with a simple row of data like this:
I have a looping VBA routine which adds the values in column C to a running total variable ‘Total_T’ when there is a ‘1’ in column D.
If the table expands like this:
How do I code the thing to detect each occurrence of a ‘1’ in column D, and add the corresponding value from column C to ‘Total_T’
At the moment, I’m detecting the presence of a ‘1’ with the array formula “{=IF(D1
5=1,1,0)}” which gives a ‘1’ if any of the cells is equal to 1.
And P.S. How do I put tables like this in my post so they line up nicely?![[lookaround] [lookaround] [lookaround]](/data/assets/smilies/lookaround.gif)
Chris
Varium et mutabile semper Excel
I started with a simple row of data like this:
Code:
A B C D
1 Engine 30 =M*(-LN(RAND())) =IF(C1<B1,1,0)
If the table expands like this:
Code:
A B C D
1 Engine 30 =M*(-LN(RAND())) =IF(C1<B1,1,0)
2 Gearbox 300 =M*(-LN(RAND())) =IF(C2<B2,1,0)
3 Suspension 500 =M*(-LN(RAND())) =IF(C3<B3,1,0)
4 Steering 500 =M*(-LN(RAND())) =IF(C4<B4,1,0)
5 Brakes 120 =M*(-LN(RAND())) =IF(C5<B5,1,0)
At the moment, I’m detecting the presence of a ‘1’ with the array formula “{=IF(D1
And P.S. How do I put tables like this in my post so they line up nicely?
![[lookaround] [lookaround] [lookaround]](/data/assets/smilies/lookaround.gif)
Chris
Varium et mutabile semper Excel