Generate another Columm of weighed values

moose2210

New Member
Joined
Jun 13, 2011
Messages
4
Hi all

I am new in this forum, I'm learning to create some VB macros, an come across a big prob. I have a table with three columns

I need to create an additional column with the weighed values per host based on the 2 column. The total of all the values which correspond to a host needs to be calculated

Can someone show me the light please!!
host ocurrences Weighed values
A 315 0.753588517
A 100 0.23923445
A 3 0.007177033
B 270
B 47
B 2
Cc 443
Cc 45
Cc 18
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
The SUMIF() function can be used to calculate the individual row value as a percentage of the sum of all values for each host.

The formula in C2 is...

=B2/SUMIF(A:A,A2,B:B)


The table looks like this...

<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="font-weight: bold;;">host</td><td style="font-weight: bold;;">ocurrences</td><td style="font-weight: bold;;">Weighed values</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">A</td><td style="text-align: right;;">315</td><td style="text-align: right;background-color: #FFFF00;;">0.753588517</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">A</td><td style="text-align: right;;">100</td><td style="text-align: right;;">0.23923445</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">A</td><td style="text-align: right;;">3</td><td style="text-align: right;;">0.007177033</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">B</td><td style="text-align: right;;">270</td><td style="text-align: right;;">0.846394984</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">B</td><td style="text-align: right;;">47</td><td style="text-align: right;;">0.147335423</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style=";">B</td><td style="text-align: right;;">2</td><td style="text-align: right;;">0.006269592</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style=";">Cc</td><td style="text-align: right;;">443</td><td style="text-align: right;;">0.875494071</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style=";">Cc</td><td style="text-align: right;;">45</td><td style="text-align: right;;">0.088932806</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style=";">Cc</td><td style="text-align: right;;">18</td><td style="text-align: right;;">0.035573123</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br />
 
Upvote 0

Forum statistics

Threads
1,224,516
Messages
6,179,231
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top