I have 3 tables:
Table1- for First data (dynamic data, get from other sheet)
Table2- Reference to get "score"
Table3- Final result "score"
We need to read first var in Table2, compare with first var in Table1, then do some compare like folowwing (I have them inside sheet attach)
Step 1 Read Var1-Table2
Step 2 Compare with Var1-Table1
Step 3 if its true, compare with small Table 1-Xn (n choose only 1 value from 1 to 4)
Step 3-1 Compare with Table 2
Step 3-2 If result same table1- same Row - print with Table2-result1
Step 3-3 If result same table1- other Row - print with Table2-result2
Step 3-4 Final result write to Table 3 (final result)
Step 4 If it not true, write to 0 to Table3, return Step1, do loop to the End
For example, after run vba, when Apple in Table1-X2, loop run for Table1-X2 (row 4-6), meet Banana in other row, final result = 1 in table3
Can someone help me for do by vba ? Thank a lot.
Table1- for First data (dynamic data, get from other sheet)
Table2- Reference to get "score"
Table3- Final result "score"
We need to read first var in Table2, compare with first var in Table1, then do some compare like folowwing (I have them inside sheet attach)
Step 1 Read Var1-Table2
Step 2 Compare with Var1-Table1
Step 3 if its true, compare with small Table 1-Xn (n choose only 1 value from 1 to 4)
Step 3-1 Compare with Table 2
Step 3-2 If result same table1- same Row - print with Table2-result1
Step 3-3 If result same table1- other Row - print with Table2-result2
Step 3-4 Final result write to Table 3 (final result)
Step 4 If it not true, write to 0 to Table3, return Step1, do loop to the End
For example, after run vba, when Apple in Table1-X2, loop run for Table1-X2 (row 4-6), meet Banana in other row, final result = 1 in table3
Request-v0.1.xlsx | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | |||
1 | |||||||||||||||||
2 | Table1-First data | ||||||||||||||||
3 | Table1-Var1 | ||||||||||||||||
4 | |||||||||||||||||
5 | Table1-X1 (row1-3) | ||||||||||||||||
6 | |||||||||||||||||
7 | |||||||||||||||||
8 | Apple | Table1-X2 (row4-6) | |||||||||||||||
9 | Banana | ||||||||||||||||
10 | |||||||||||||||||
11 | Table1-X3 (row7-9) | ||||||||||||||||
12 | |||||||||||||||||
13 | Peach | Cherry | |||||||||||||||
14 | Table1-X4 (row10-12) | ||||||||||||||||
15 | |||||||||||||||||
16 | |||||||||||||||||
17 | |||||||||||||||||
18 | Table2- Mixed | ||||||||||||||||
19 | Same table1-X ~ same Row | Same table1-X ~ other Row | |||||||||||||||
20 | Table2- var1 | Table2-result1 | Table2-Result2 | Table3-Final result | |||||||||||||
21 | 1 | Apple | Banana | 2 | 1 | 1 | |||||||||||
22 | 2 | Apple | Banana | Grape | 4 | 3 | |||||||||||
23 | 3 | Apple | Mango | -2 | 0 | ||||||||||||
24 | 4 | Apple | Mango | Starfruit | papaya | -4 | -2 | ||||||||||
25 | 5 | ||||||||||||||||
26 | 6 | ||||||||||||||||
27 | |||||||||||||||||
28 | Peach | cherry | 3 | 2 | 3 | ||||||||||||
29 | Peach | cherry | coconut | 5 | 4 | ||||||||||||
30 | |||||||||||||||||
31 | |||||||||||||||||
32 | |||||||||||||||||
33 | n | ||||||||||||||||
Sheet1 |
Can someone help me for do by vba ? Thank a lot.