Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-15-2014, 09:15 PM
rkobeyer rkobeyer is offline Spread whole number across specific months in a year Windows 8 Spread whole number across specific months in a year Office 2013
Novice
Spread whole number across specific months in a year
 
Join Date: Oct 2014
Posts: 2
rkobeyer is on a distinguished road
Smile Spread whole number across specific months in a year

Hi


Is it possible to spread whole numbers (not decimals) across a year?

For example if I have a total of 33 and I want to spread it from January to August the formula should give the below result.

J F M A M J J A S O N D
4 4 4 4 4 4 4 5

If 33 is spread evenly from January to December it would look like this:

J F M A M J J A S O N D
2 2 2 3 3 3 3 3 3 3 3 3

With larger numbers skewed toward the end of the year.

I have attached a file with the layout in excel and the expected totals the formula should give for each month.

I have been working on this all day but haven't gotten anywhere! You can see in Sheet 2 my previous attempts if it helps.

Any help I get I will be eternally grateful for!

MonthSpread.xlsm

Cheers,
Russell
Reply With Quote
  #2  
Old 10-16-2014, 12:37 AM
rkobeyer rkobeyer is offline Spread whole number across specific months in a year Windows 8 Spread whole number across specific months in a year Office 2013
Novice
Spread whole number across specific months in a year
 
Join Date: Oct 2014
Posts: 2
rkobeyer is on a distinguished road
Default Can I pay someone?

Can I pay someone to solve this for me? I tried contacting a few freelance excel workers, but they haven't replied.
Reply With Quote
  #3  
Old 10-18-2014, 11:46 PM
macropod's Avatar
macropod macropod is offline Spread whole number across specific months in a year Windows 7 64bit Spread whole number across specific months in a year Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I'm assuming you have some other code that loops through the rows and all you're after is the basic logic for working out the #s to populate the 'spread' range. The following code shows how to do that, taking a value entered in an InputBox as the # to spread and the selected range as the cells over which the spreading is to be done:
Code:
Sub Demo()
Dim i As Long, j As Long, k As Long, l As Long, x As Long
i = CLng(InputBox("Number to spread?", , 0))
j = Selection.Cells.Count
k = -Int(-i / j)
l = k * j - i
For x = 1 To l
  Selection.Cells(x).Value = k - 1
Next
For x = l + 1 To j
  Selection.Cells(x).Value = k
Next
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Spread whole number across specific months in a year Counting Number of Months from a static date bremen22 Excel 4 11-25-2013 11:57 AM
Spread whole number across specific months in a year Converting serial number to years, months and days hannu Excel 6 02-14-2013 09:21 PM
How to count year lapse (rounded off) based on specific date KIM SOLIS Excel 1 11-01-2011 10:50 AM
Creative Ways for a year-to-year comparison??? ridonkulous5 Excel 1 03-23-2011 04:49 PM
Setting up recurring months to skip some months etc. dwelch@ykfireprevention.c Outlook 0 11-30-2010 10:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:28 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft