PDA

View Full Version : Match two rows across various columns using VBA



Kartyk
12-27-2016, 12:36 AM
Hi All,

Requirement :


* A Trade (source column) is always compared agianst Invoice (source column)
* First step is to validate if Match ID's are always equal. In most cases, there will only be two rows that has Match ID equal
* Counterparty name will match exactly but then there are two sub conditions :
1 Match only first 4 characters or alphabets in the cell
2 Should it fail, then refer to mapping table, on the adjacent sheet, where a mapping would be provided
* Notional : Has Three validations
1 Compare Invoice line item against trade item
2 If the above doesnt match, then match it against Trade item under Amt. in Buy Curr column
3 If the above doesnt match, then match it against Trade item under Amtount in Selll Curr column
* Curr Cross : Match the Invoice line item against the trade item.


If the above criterias fail, then mark result as fail, under "Result" column. And also, list the failure element under "Comment" column

Logit
12-27-2016, 06:05 PM
Not certain how far your code functions correctly ... however, the following Column Header [ TYPE ] is missing and your code is failing on this line:


matchcol4 = Range("A1:K2").Find(What:="Type", LookIn:=xlValues, LookAt:=xlWhole, _

Kartyk
12-27-2016, 08:10 PM
My code is WIP and i was hoping to find a much efficient code on this forum ... Yes, i have removed Type as it is no longer in play.