VBA obtain the breakdown of the total value of a cell

gubertu

Board Regular
Joined
May 24, 2015
Messages
147
Hi all,

I have the following doubt. Hope you could help me.

I have two sheets: 1) "Data" and 2) "Fixed assets".

Tab "Data"

AB
1AccountsValues
22102.000
32203.000

Tab "Fixed assets"

ABC
1TitlesValuesFormula
2Buldings5.000SUMIF('Data:A:A;210;Data:B:B)+SUMIF('Data:A:A;220;Data:B:B)
3Machinery0


The value of cell B2 of tab "Fixed assets" is 5.000. I would like to press that cell and know exactly what is the breakdown of those 5.000. For example, to be redirected to tab "Data" and have the cells B2:B3 highlighted or something.

Is there any code or any way in Excel to do this?

Hope you could help me.

Thanks in advance
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Using your current table, that is impossible. If you create a helper column where you can put the search value 210, then it is possible. You could even put 210 and 220 in the same cell with a comma as a delimeter and it could be possible. For example say "Fixed assets" C2 you entered 210|220. You used the pipe as the delimeter. On selection change, make it check which cell you selected. Then it would run code. The code would see what row the celected cell is in. You selected B2, so it would use row 2 and it would check your helper column C to see what is in there. It would check if there is a | pipe and if there is not, it would just run the code one time. If there is 1 or more pipes, it would run the code enough times to check if each value exists in your "Data" sheet. First it would check 210, then 220. It would highlight when results are found. It would clear any highlights from previous results before running the code.

I don't have time to write that code for you, as it would take me an hour. Just wanted to provide you with an idea for a solution because your current table makes it impossible to accomplish your task.
 
Upvote 0
Hi and thanks for the reply.

I see your approach, but for me is quite complicated.

What if I build the charts based on a Pivot table? I can configure it and if I double click on a cell, I would know the breakdown of every cell.

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,785
Members
449,095
Latest member
m_smith_solihull

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