LalitPandey87
04-03-2012, 06:42 PM
Hi All,
I have some data ex:
Category
Sub Category
Values
asd
2
asd
4
edf
2
asd
3
aec
a
2
edf
a
1
aef
a
2
qwe
a
1
aef
a
4
i need some formula or VBA which can do the calculation according to below condition:
1:- If Category contains value but sub cat. doesn't and there is only single entry for this then the output will be the value of the entry
2:- If Category contains value but sub cat. doesn't and there is more then one entry for this then the output will be the average of the values
3:- If Category and sub cat. both contains value and there is only single entry for this then the output will be the value of the entry
4:- If Category and sub cat. both contains value and there is more then one entry for this then the output will be the average of the values
5:- If Category and sub cat. both contain values and category are same but sub cat. are differ then the output will be the value of the entry
and Output will be like this:
Category
Sub Category
Values
OutPut
asd
2
3
asd
4
3
edf
2
2
asd
3
3
aec
a
2
2
edf
a
1
1
aef
a
2
3
qwe
a
1
1
aef
a
4
3
Thanks in Advance.
I have some data ex:
Category
Sub Category
Values
asd
2
asd
4
edf
2
asd
3
aec
a
2
edf
a
1
aef
a
2
qwe
a
1
aef
a
4
i need some formula or VBA which can do the calculation according to below condition:
1:- If Category contains value but sub cat. doesn't and there is only single entry for this then the output will be the value of the entry
2:- If Category contains value but sub cat. doesn't and there is more then one entry for this then the output will be the average of the values
3:- If Category and sub cat. both contains value and there is only single entry for this then the output will be the value of the entry
4:- If Category and sub cat. both contains value and there is more then one entry for this then the output will be the average of the values
5:- If Category and sub cat. both contain values and category are same but sub cat. are differ then the output will be the value of the entry
and Output will be like this:
Category
Sub Category
Values
OutPut
asd
2
3
asd
4
3
edf
2
2
asd
3
3
aec
a
2
2
edf
a
1
1
aef
a
2
3
qwe
a
1
1
aef
a
4
3
Thanks in Advance.