Need expert help to add / edit Code

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hello experts,
This is how I match Portal & Tally - Valid only for up to 20,000 rows of data because of the range in the formula. I change the range in the formula if the rows are more than that.
First, I Check the Integrated Tax column, if it is not in column G, then I shift it to column G. Then, Sort data by "Integrated Tax" > largest to smallest. Enter formula in J2 with control + Shift + Enter
Rich (BB code):
=IFERROR(IF(ROW(B2)<=SMALL(IF((ABS(G2-$G$2:$G$20000)<=1)*(C2=$C$2:$C$20000)*(B2=$B$2:$B$20000),ROW($A$2:$A$20000),""),MIN(SUM(IF(($C$2:$C$20000=C2)*(ABS(G2-$G$2:$G$20000)<=1)*($B$2:$B$20000="PORTAL"),1,0)),SUM(IF(($C$2:$C$20000=C2)*(ABS(G2-$G$2:$G$20000)<=1)*($B$2:$B$20000="TALLY"),1,0)))),"Matched",NA()),NA())

Drag down only till the cell values are >0 in "Integrated Tax" column. Copy the result and paste it back with paste special to remove the formulas. Next I shift the Central Tax column to G2. Then again, Sort data by Central Tax > largest to smallest. Enter formula in J2 with control + Shift + Enter
Rich (BB code):
=IFERROR(IF(ROW(B2)<=SMALL(IF((ABS(G2-$G$2:$G$20000)<=1)*(C2=$C$2:$C$20000)*(B2=$B$2:$B$20000),ROW($A$2:$A$20000),""),MIN(SUM(IF(($C$2:$C$20000=C2)*(ABS(G2-$G$2:$G$20000)<=1)*($B$2:$B$20000="PORTAL"),1,0)),SUM(IF(($C$2:$C$20000=C2)*(ABS(G2-$G$2:$G$20000)<=1)*($B$2:$B$20000="TALLY"),1,0)))),"Matched",NA()),NA())

Drag down only till the cell values are >0 in "Central Tax" column. Copy the result and paste it back with paste special to remove the formulas. I change the contents of the column J2 from formula to values, which I do by copying the whole column and pasting it back with paste special values. There are instances when there are blanks in both IGST & CGST. Those too will be treated as mismatches. Finally, without deleting the Edited Portal sheet, I have to divide it into 2 sheets. One with matches and the other with mismatches, i.e., errors. In this case, as it is a sample data there is just only one mismatch. In original data, up to 20% of the data may have mismatches. This will complete 80% of the manual work involved. With your help & expertise
Please note: There is a possibility that the Invoice Date and Invoice Number may be different in Tally from Portal in most of the cases. Most of the Invoice number could be a partial match. The dates may be an exact match to a certain extent (50%). So, it is not a good idea to consider these columns to match between the two.
The CGST & CGST amount are always the same (99.99%).
The only common values between the 2 is the GSTIN number.
Thank you in advance.
Code to Match Portal & Tally.xlsm
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I mean cut and paste. The formula I apply is directed to column G. So, to match IGST first, I shift the column IGST to column G by selecting the column + control X, to cut the column and +insert than before H with control + to paste the column. Same in the case when I match CGST.
 
Upvote 0
I somehow feel, that will not be needed in the code as you will be doing something like if IGST & CGST = blank then show blank, if IGST > 0 then match IGST portal with IGST Tally else match CGST portal with CGST tally. Just imagined.
 
Upvote 0
When would Integrated Tax not be the G column? If it wasn't in the G column then your header row would be wrong. This is being done on the 'Edited Portal' sheet, right?
 
Upvote 0
First, I Check the Integrated Tax column, if it is not in column G, then I shift it to column G.
With your code, it will be in column G. But by chance, you never know.....You can avoid that. I think it will not be necessary as the code by default will display Integrated tax in Column G . But you will have to think about the shifting the column Central Tax.
 
Upvote 0
What Insanity pill would you take to not use my code? :p
 
Upvote 0
Fair enough. Can we assume the header row will always be the first row and the titles will remain the same in the header row?
 
Upvote 0
I already did that with one of your codes and now I am stuck very badly. Insanity is the right word. ?
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

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