logandiana
Board Regular
- Joined
- Feb 21, 2017
- Messages
- 107
Can't figure this one out. Hopefully something simple.
In column AN, the formula works the way it should.
=IFERROR(IF(AND(ISNUMBER(MATCH(CONCATENATE("0000000",F2,B2),$AF:$AF,0)),NOT(ISNUMBER(MATCH(F2,$S:$S,0)))),"Returned",IF(ISNUMBER(MATCH(F2,$K:$K,0)),"Sold",IF(INDEX(SAPCrosstab4,MATCH(F2,$S:$S,0),2)="R2","R2-ReturnedDamaged",IF(INDEX(SAPCrosstab4,MATCH(F2,$S:$S,0),2)="F2","F2-FieldScrap",IF(INDEX(SAPCrosstab4,MATCH(F2,$S:$S,0),2)="L0","L0-Lost","NotReturned"))))),"NotReturned")
I used the macro recorder to help with the code to copy down approximately 8000 lines in column AN.
The recorder gave me:
So I plugged that in with the rest to get:
But when I step through I get a 1004 , application defined or object defined error.
I can't figure why its not working though. Is the formula to long or something?
In column AN, the formula works the way it should.
=IFERROR(IF(AND(ISNUMBER(MATCH(CONCATENATE("0000000",F2,B2),$AF:$AF,0)),NOT(ISNUMBER(MATCH(F2,$S:$S,0)))),"Returned",IF(ISNUMBER(MATCH(F2,$K:$K,0)),"Sold",IF(INDEX(SAPCrosstab4,MATCH(F2,$S:$S,0),2)="R2","R2-ReturnedDamaged",IF(INDEX(SAPCrosstab4,MATCH(F2,$S:$S,0),2)="F2","F2-FieldScrap",IF(INDEX(SAPCrosstab4,MATCH(F2,$S:$S,0),2)="L0","L0-Lost","NotReturned"))))),"NotReturned")
I used the macro recorder to help with the code to copy down approximately 8000 lines in column AN.
The recorder gave me:
Code:
.FormulaR1C1 = "=IFERROR(IF(AND(ISNUMBER(MATCH(CONCATENATE(""0000000"",RC[-34],RC[-38]),C32,0)),NOT(ISNUMBER(MATCH(RC[-34],C19,0)))),""Returned"",IF(ISNUMBER(MATCH(RC[-34],C11,0)),""Sold"",IF(INDEX(SAPCrosstab4,MATCH(RC[-34],C19,0),2)=""R2"",""R2-ReturnedDamaged"",IF(INDEX(SAPCrosstab4,MATCH(RC[-34],C19,0),2)=""F2"",""F2-FieldScrap"",IF(INDEX(SAPCrosstab4,MATCH(RC[-34],C19,0)=""L0"",""L0-Lost"",""NotReturned""))))),""NotReturned"")"
So I plugged that in with the rest to get:
Code:
Dim bi As Worksheet
Dim LR1 As Long
Set bi = ThisWorkbook.Worksheets("BI_Data")
LR1 = bi.Range("SAPCrosstab1").Rows.Count
With bi
.Range("AN2:AN" & LR1).FormulaR1C1 = "=IFERROR(IF(AND(ISNUMBER(MATCH(CONCATENATE(""0000000"",RC[-34],RC[-38]),C32,0)),NOT(ISNUMBER(MATCH(RC[-34],C19,0)))),""Returned"",IF(ISNUMBER(MATCH(RC[-34],C11,0)),""Sold"",IF(INDEX(SAPCrosstab4,MATCH(RC[-34],C19,0),2)=""R2"",""R2-ReturnedDamaged"",IF(INDEX(SAPCrosstab4,MATCH(RC[-34],C19,0),2)=""F2"",""F2-FieldScrap"",IF(INDEX(SAPCrosstab4,MATCH(RC[-34],C19,0)=""L0"",""L0-Lost"",""NotReturned""))))),""NotReturned"")"
End With
But when I step through I get a 1004 , application defined or object defined error.
I can't figure why its not working though. Is the formula to long or something?