Special sum of texts
Hello,
I try to write macro which will sum text in new column, but in special way,
but it is to complicated for me. How is should works:
- when in data3 or data4 is bbxx (when xx is 01,02 €¦) then in column SUM for
all line containing this data should be bbxx
- when in data2 is aax and data3, data4 are empty then SUM is aax
- when in data 3 or 4 cccxx and data2 is empty then SUM is cccxx
- when in data 3 or 4 is bbxx and in data3 and data4 is cccxx then SUM for
all line containing this data is cccxx
- when in data3 or 4 is cccxx and in data 3 or 4 is cccxy for all this line
SUM is cccxx+cccxy
- when in data2 is aaxx and is data3 or 4 is cccxx then in all line SUM is
cccxx
- when in data2 is aaxx and aaxy and in data3 or 4 is cccxx and cccxy then
SUM is cccxx+cccxy
Example
data1 data2 data3 data4 SUM
1
2 bb01 bb01
3 bb01 bb01
4 ccc02 ccc02
5 ccc06 ccc06+ccc07
6 ccc02 ccc02
7 ccc06 ccc07 ccc06+ccc07
8 ccc07 ccc06+ccc07
9 ccc07 ccc06+ccc07
10 bb02 ccc01
11 ccc01 bb02 ccc02
12 cc01 ccc03
13 ccc03 ccc03
14 aa1 ccc03 ccc03
15 aa1 ccc03
16 aa2 ccc04 ccc04+ccc05
17 aa3 ccc04 ccc04+ccc05
18 aa2 ccc05 ccc04+ccc05
19 aa3 ccc05 ccc04+ccc05
20 aa4 aa4
21 aa4 aa4
All this connections can be joint together like he
22 bb03 ccc08+ccc09+ccc10
23 bb03 ccc10 ccc08+ccc09+ccc10
24 ccc10 ccc08+ccc09+ccc10
25 ccc09 ccc08+ccc09+ccc10
26 ccc08 ccc08+ccc09+ccc10
27 aa5 ccc08 ccc08+ccc09+ccc10
28 aa5 ccc09 ccc08+ccc09+ccc10
29 aa5 ccc10 ccc08+ccc09+ccc10
Best Regards,
Bartosz
|