rajendra kodavaty
rajendra kodavaty

Reputation: 13

Calculate percentage contribution of a dynamic changing range

I am novice to excel vba. I have written much of the Vba code for my program. need help in writing code for the below situation.

I have column A with various codes, column B has specified value for the respective codes in the corresponding month (Dynamically range changes from month to month)

Finally the column C should return the percentage contribution of the particular code.

Since this is a monthly activity, i need to macro to run the same

COL A   COL B   COL C
4001    25      19%
4002    25      19%
4003    10       7%
4004    20      15%
4005    20      15%
4006    34      25%

4001, COLC = 25/134 = 18.66%

The column A and B range changes dynamically with the month

Upvotes: 1

Views: 750

Answers (1)

Aditya Pansare
Aditya Pansare

Reputation: 1132

You do not need a macro to get this result; use below formula in C2 and fill it until the end

=B2/SUM(B:B)

Upvotes: 2

Related Questions