bobbyexcel
Board Regular
- Joined
- Nov 21, 2019
- Messages
- 88
- Office Version
- 365
- Platform
- Windows
Can someone please help me on the below formula ..
Here I'm writing 3 different formulas which gives the same result.. but not sure how to write using vba.
Formula 1: In Col L : =COUNTIFS($A$2:$A$18,A2,$C$2:$C$18,C2,$I$2:$I$18,">""",$K$2:$K$18,">"&K2) + 1
Formula 2: In Col M : this formula is from macro recorder..
Formula 3: In Col L : Now I want to customize with lastrow which is not giving proper results.. Need help on this..
Here I'm writing 3 different formulas which gives the same result.. but not sure how to write using vba.
Formula 1: In Col L : =COUNTIFS($A$2:$A$18,A2,$C$2:$C$18,C2,$I$2:$I$18,">""",$K$2:$K$18,">"&K2) + 1
Formula 2: In Col M : this formula is from macro recorder..
VBA Code:
Dim Lastrow As Long
Lastrow = Range("L" & Rows.Count).End(xlUp).Row
Range("M2:M" & Lastrow).Formula = "=COUNTIFS(R2C1:R12C1,RC[-12],R2C3:R12C3,RC[-10],R2C9:R12C9,"">"""""",R2C11:R12C11,"">""&RC[-2]) + 1"
[B][U]
VBA Code:
[/U][/B]
Dim Lastrow As Long
Lastrow = Range("L" & Rows.Count).End(xlUp).Row
Range("M2:M" & Lastrow).Formula = Application.WorksheetFunction.CountIfs( _
Range("$A$2:$A$" & Lastrow), A2, _
Range("$C$2:$C$" & Lastrow), C2, _
Range("$I$2:$I$" & Lastrow), ">""", _
Range("$K$2:$K$" & Lastrow), ">" & K2) + 1
Last edited by a moderator: