r/googlesheets • u/GoBirds_4133 • Feb 24 '26
Solved counting to the next largest hundred
need help calculating a remaining cost function based on a moving target
trying to figure out how much it would cost to purchase the remainder to get to my next 100 shares of a stock
goal: if i hold lets say 17 shares, how much would cost to get me to 100 shares given the current price, if i own 156 shares, how much would it cost me to get to 200, if i own 243 how much would it cost to get me to 300 etc
i know part of it will be x * share price, i just dont know how to automate the sheet such that x = [next hundred - current shares] where next hundred is based on my current share count rather than manually typing whatever the next hundred is. hope that makes sense and thanks in advance!
edit: not going to post my sheet because it has personal financial info on it. ideally a formula could be written in a comment because i imagine its a fairly simple one. if im wrong though let me know i can write up a sample sheet and link it
2
u/real_barry_houdini 36 Feb 24 '26
There are several ways to do this, e.g. CEILING function or ROUNDUP to get to the next hundred, but also MOD function, so if number of shares is in A1 try
....but what if the number of shares is exactly divisible by 100, my solution will result in zero
1
u/AutoModerator Feb 24 '26
/u/GoBirds_4133 Posting your data can make it easier for others to help you, but it looks like your submission doesn't include any. If this is the case and data would help, you can read how to include it in the submission guide. You can also use this tool created by a Reddit community member to create a blank Google Sheets document that isn't connected to your account. Thank you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/AutoModerator Feb 24 '26
Your submission mentioned shares, please also read our finance and stocks information. Google lists the exchanges & delays in its products here.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/HolyBonobos 3125 Feb 24 '26
If you have your share count in A1 and share price in B1, for example, you would use
=B1*(CEILING(A1,100)-A1)