montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 986
- Office Version
- 2010
- Platform
- Windows
Hi. First my excel have a problem, meaning I am NOT able to upload the xl2bb, for this reazon I am NOT loading a partial sheet here, sorry, sorry.
OK, now my question today is:
My data is a ►"DYNAMIC"◄ array at B2:G2800
the computations I am trying is the formulas SUMPRODUCT((mod(B2:G2,2)=0)+0) , and SUMPRODUCT((MOD(B2:G2,2)<>0)+0)
and display the results on M and N
what I did so far is try a normal way (the easy one first)
with this the result are on M and N and of course only two cells with right answer. obvious I need a loop to read the whole array and populate column M/N
so my second try with a loop is:
the results with this loop is zeros and ones only (wrong results)
and remember I already explain I am not able to use xl2bb. so the image here maybe help. (sorry)
I am doing my best.
Thank you for reading this
OK, now my question today is:
My data is a ►"DYNAMIC"◄ array at B2:G2800
the computations I am trying is the formulas SUMPRODUCT((mod(B2:G2,2)=0)+0) , and SUMPRODUCT((MOD(B2:G2,2)<>0)+0)
and display the results on M and N
what I did so far is try a normal way (the easy one first)
VBA Code:
Sub even_odds()
Sheet5.Range("M2").Formula = "=SUMPRODUCT((mod(B2:G2,2)=0)+0)"
Sheet5.Range("N2").Formula = "=SUMPRODUCT((MOD(B2:G2,2)<>0)+0)"
End Sub
so my second try with a loop is:
VBA Code:
Sub Trial_error()
Dim monte As Long, carlo As Long
monte = 2
For carlo = 5 To Cells(Rows.Count, "B").End(xlUp).Row
Sheet5.Range("M" & carlo).FormulaR1C1 = "=sumproduct((mod(R2C" & monte & ":R2C" & monte & ",R2C1:R2C1)=0)+0)"
Sheet5.Range("N" & carlo).FormulaR1C1 = "=sumproduct((mod(R2C" & monte & ":R2C" & monte & ",R2C1:R2C1)<>0)+0)"
monte = monte + 1
Next carlo
End Sub
and remember I already explain I am not able to use xl2bb. so the image here maybe help. (sorry)
I am doing my best.
Thank you for reading this