Replace formula in this code

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hello guys, I need your help to replace the formula in the code with the new formula.

Rich (BB code):
With wsDestination.Range(DestinationRemarksColumn & "2")
        .FormulaArray = "=IFERROR(IF(ROW(B2)<=SMALL(IF((ABS(" & DSCol & "2-$" & DSCol & "$2:$" & DSCol & _
                "$20000)<=1)*(C2=$C$2:$C$20000)*(B2=$B$2:$B$20000),ROW($A$2:$A$20000),""""),xxxxxx)" & _
                ",""Matched"",NA()),NA())"                                                              '   Formula to insert into 'Remarks' column
        .Replace "xxxxxx", FormulaReplacementString1, xlPart                                            '   Insert additional string into formula
    End With
New formula
Rich (BB code):
=IF(MATCH(1,((ABS(G2-$G$2:$G$23200)<=1))*(C2=$C$2:$C$23200)*(F2=$F$2:$F$23200)*(B2<>$B$2:$B$23200),0),"Matched","")
Old formula
Rich (BB code):
=IF(MATCH(1,((ABS(G2-$G$2:$G$23200)<=1))*(C2=$C$2:$C$23200)*(B2<>$B$2:$B$23200),0),"Matched","")
 
Of course you are. Compare the post #1 formula to your most recent attempt at the via code… hint you are missing something at the end. ;)
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I corrected it closing bracket right but still getting compile error.
Rich (BB code):
 With wsDestination.Range(DestinationRemarksColumn & "2")
        .FormulaArray = "=IF(MATCH(1,((ABS(G2-$G$2:$G$23200)<=1))*(C2=$C$2:$C$23200)*(F2=$F$2:$F$23200)*(B2<>$B$2:$B$23200),0),"Matched","")                                                            '   Formula to insert into 'Remarks' column
    End With
 
Upvote 0
Your formula is starting with a quote, I don't see where you ended it though.
 
Upvote 0
Rich (BB code):
With wsDestination.Range(DestinationRemarksColumn & "2")
        .FormulaArray ="=IF(MATCH(1,((ABS(G2-$G$2:$G$23200)<=1))*(C2=$C$2:$C$23200)*(F2=$F$2:$F$23200)*(B2<>$B$2:$B$23200),0),"Matched","")"                                                            '   Formula to insert into 'Remarks' column
    End With
 
Upvote 0
Man we are so close now. :)

Now go back and read the last line of post #3.
 
Upvote 0
Finally, Got it right. ROTF. It was so simple for you yet you made me stay awake so late. Ok It was worth it.
Thank you JohnnyL.
 
Upvote 0
Finally!

You blame me when everything you needed was handed to you in post #3.

Well now you hopefully have learned how to convert the excel spreadsheet formula to vba code.

something further to sleep on ... .formula in vba code is equivalent with enter ..... .FormulaArray in vba code is equivalent with Control+Shift+Enter
 
Upvote 0
Finally!

You blame me when everything you needed was handed to you in post #3.

Well now you hopefully have learned how to convert the excel spreadsheet formula to vba code.

something further to sleep on ... .formula in vba code is equivalent with enter ..... .FormulaArray in vba code is equivalent with Control+Shift+Enter
Yes. Thank you.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top