Posted: Wed Mar 11, 2009 11:24 am Post subject: Compare Numbers Strings Using VBA (multiple criteria)
Hi guys,
I have two tables (each with 2 columns) with numbers stored as text on two different sheets.
The first one is from product code and D/C (disount category) and the second is from product category and D/C.
The problem is both ranges are of different lengths and I have to find out if a product from the right is part of a particular product category. Even if the length is different the first digits are indicative of the belonging of a code. For example 1234 and 12345 are “family”-their first 4 digits match. If the ranges prove to be family the next comparison is for D/C. Only if the "family" and D/C matches can we put "compliant" in the next cell.
Just to give you an example of what is desired:
So, the loop should do the following:
Compare the first string from the “Category” column to each and every entry on the right, if a match exists (we have no match here for 2200) then compare the D/C and if both match write “ok” next to it.
Next trim one digit from the right from every string in the “Code” column.
Compare same first string from the “Category” column to each trimmed string from “Code” column (here we should have a match 2200=2200) then compare the D/C and if both match write “ok” next to it
Write “ok” next to it
Now the loop goes to the second string from “Category” column and for this one we will have to trim 2 digits from the right of each string in “Code” column to achieve the result (2323=2323) but because the D/C does not match it will go as non compliant and so on.
Please note that strings can be of different sizes in both directions.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum