Excel macro for returning values based on adjacent cells and further calculations

MiteshG

New Member
Joined
Sep 12, 2022
Messages
23
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi Members,

I have excel data in following format. (example)

Entity​
Shareholder 1​
Shareholding %​
Shareholder 2​
Shareholding %​
Shareholder 3​
Shareholding %​
ABC​
XYZ ltd​
50​
STU ltd​
25​
PQR ltd​
25​
XYZ ltd​
DEF ltd​
75​
JKL ltd​
25​

Based on this data, I would like to calculate indirect shareholding % of DEF ltd in each entity. Like below -
Entity​
Shareholder 1​
Shareholding %​
Shareholder 2​
Shareholding %​
Shareholder 3​
Shareholding %​
DEF Ltd. Indirect Holding %​
ABC​
XYZ ltd​
50​
STU ltd​
25​
PQR ltd​
25​
37.5​
XYZ ltd​
DEF ltd​
75​
JKL ltd​
25​
75​

I have done this calculation manually but this is to be done for multiple rows. What is the best way to do this calculation through either macro or formula?

Thanks in advance for the help.
 
I just really cannot wrap my head around a good what to do it. I have to check 4 different columns could also make the formula very long and messy.
If your data was structured differently, it might be a little easier, where you only had one column for Shareholder number and Shareholder amount, i.e.

if instead of having the data structured like this:
EntityShareholder 1Shareholding %Shareholder 2Shareholding %Shareholder 3Shareholding %
ABCXYZ ltd
50​
STU ltd
25​
PQR ltd
25​
XYZ ltdDEF ltd
75​
JKL ltd
25​

it was structured in a more normalized function like this:
EntityShareholder NumberShareholder NameShareholding %
ABC1XYZ ltd
50​
ABC2STU ltd
25​
ABC3PQR ltd
25​
XYZ ltd1DEF ltd
75​
XYZ ltd2JKL ltd
25​

it might be easier to work with, as then you only have one column with "Shareholder Name" and "Shareholding %" to work with, though I still cannot wrap my head around exactly how to do it.
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

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