I'm working on a building a export file of Portfolio Holdings that will be imported into a system that can only take whole integers.
The access database I’m pulling from stores and calculated the individual holdings weighting based on home many securities are selected to be held.
ex. 25% of the portfolio is allocated among 4 securities. 25/4 = 6.25 per security. Or this could change to 25% allocated among 3 securities…25/3=8.33 (realistically N securities) Problem arises when I round. If all are rounded down, 8+8+8=24 not 25. At the end of the day I need various groups of 25%(any size group, with any # of holdings within the group) to add up to 100%.
Any Ideas?
Reply from Richard Rost:
You would have to perform the math, rounding down. Then, when you're done, check the sum of the parts, and if they don't add up, add 1 to the first (or last) item in the group.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.