drsudhakar
New Member
- Joined
- Jan 25, 2018
- Messages
- 6
Dear all
I need to get average, max and min of cells (all numbers) in column P, if data in column R is = 1 or >1.
My dataset has varying number of rows depending on amount of work happened, for which I am using dynamic last row (LR). I could figure out the formula for average as below :
sheet.Range("P" & LR + 2).Formula = "=AVERAGEif(r2:r" & LR & ", "">1"", P2:P" & LR & ")"
But, for max or min function, the same is pending. Code I came for Max is as follows :
sheet.Range("P" & LR + 3).FormulaArray = "=MAX(if(r2:r" & LR & ", "">1"", P2:P" & LR & "), )"
Can somebody help please.
Thanks in advance for sharing your knowledge. I am a biologist and new to VBA.
regards
drsudhakar
I need to get average, max and min of cells (all numbers) in column P, if data in column R is = 1 or >1.
My dataset has varying number of rows depending on amount of work happened, for which I am using dynamic last row (LR). I could figure out the formula for average as below :
sheet.Range("P" & LR + 2).Formula = "=AVERAGEif(r2:r" & LR & ", "">1"", P2:P" & LR & ")"
But, for max or min function, the same is pending. Code I came for Max is as follows :
sheet.Range("P" & LR + 3).FormulaArray = "=MAX(if(r2:r" & LR & ", "">1"", P2:P" & LR & "), )"
Can somebody help please.
Thanks in advance for sharing your knowledge. I am a biologist and new to VBA.
regards
drsudhakar