I spent all day at work trying to find a solution to my problem. Most of my googleing brought me to this site, so I decided to refuse and ask for help.
I have an Excel file containing stock portfolio positions. I need to figure out how to write a macro that can tell me right away if those positions that exceed 5% of the portfolio value together exceed 40% of the portfolio value.
I have some basic understanding of VBA and I know how to choose the right column, but I cannot figure out how to sum only those positions that exceed 5% (0.05). I tried different If expressions, but I just can't figure out what is right.
Can someone please show me the way? I just need a macro to check my column and then print in MsgBox whether the positions (> = 0.05) will exceed 40% (0.40).
Thank you very much!
Example column:
Weights 0.032 0.067 0.103 . . . 0.02
source share