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","")
 
I used control + shift + enter while entering the formula
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
This is the only formula which is getting the maximum number of correct Matches. The old formula was getting more matches but it was getting the mismatched amounts too in the Matched sheet.
 
Upvote 0
I tried 3 different formulas and this is the one which gets the correct and maximum matches.
 
Upvote 0
You are not allowed to enter that formula with the 'NA' stuff at the end into excel with the CTRL+Shift+Enter, so what makes you think it will work in the VBA code?
 
Upvote 0
Let me me explain how. When there are multiple same amounts in Tally and one amount in portal, the old formula picks up all the amounts of tally and one amount in portal and sends it to the Matched sheet. Whereas it has to select only one row each from tally and portal. And vice versa.
 
Upvote 0
I am unaware of this. Now you tell me what is the solution and how do we move ahead. You are the boss.
You are not allowed to enter that formula with the 'NA' stuff
 
Upvote 0
You have to provide a formula that is acceptable to excel. The 'New' formula from post#1 here is acceptable. You can enter it in the excel spreadsheet with Control+Shift+Enter and excel will wrap it with the 'curly braces'. That formula you are trying to use with the 'NA's at the end is not accepted by excel. Try it and see what happens when you use the Control+Shift+Enter.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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