December 21st, 2010, 7:02 am
QuoteOriginally posted by: SamsaveelExcelers/VBA'ers,i have 2 sheets in excel,each contains 6 columns containing trade attributes ,e.g matrurity,trade date,index,etc.....i need to identify similar trades,what is the best way to automate the procedue.note that i do not have a common identifier such as trade number,but common attributes.in order for me to confirm that 2 trades are indistinguishable is to have a least 3 attribures the same.Thanks,It sounds like you're trying to reconcile trades, presumably with a one-for-one matching.I notice that you say SIMILAR trades rather than IDENTICAL trades. Identical trades is easy. Concatenate the 6 fields together and assuming that your data is in the same format on the other sheet, by concatenating each field you will have created a unique identifier to match using vlookups or VBA code or xlls or whatever, depending on your level of expertise and need for speed/ other requirements. Remember as a control to count the instances of each unique identifier to take into account any dupe/ identical trades you might have.For SIMILAR trades, you will need to be a bit more clever. My experience has shown that you can usually still match most of the data using the above method,(these are your strongest matches) and then focus on a sample of the remaining non-matches and find what is causing them to break. If there is a small difference in price for example, you can round both values and regenerate the unique key so they both match. If the name spellings are slightly different you can standardise/ clean up the text fields. Only weaken the matching criteria for fields that you know might have some variation on them. If you know that the date,(for example) MUST be correct, then keep that as a strict rule and make sure it is always included in your unique identifier.Remember, the more "cleaning up" you do, the weaker the match and the greater your chance of creating false positives (incorrect matching). Avoid 100% forced matching and instead aim to report any exceptions at the end which you can deal with manually. Again, Excel has formulas and pivots that you can do this semi-manually with, or you can code it in VBA, or you can use more sophisticated methods.All of the above is relatively straight forward to do in VBA and if speed really isn't important, I would recommend VBA for automation. If your VBA skills aren't up to scratch or this is only going to be done a few times then there's no harm in using Excel to speed up some of the manual processes. It's a good way to learn and understand the data you're working with.
Last edited by
hayes on December 20th, 2010, 11:00 pm, edited 1 time in total.