UPDATE 1:
This is what I am trying to do.
B1, B2, and B3 represent 3 containers
Period could be anything, days, weeks, months years, so Period 1, can mean day 1, or week 1, or month 1 or year one.
In period 1, I start off with the value 100. 60% of 100 always gets added to B1 (container 1), and 40% of 100 always gets added to B2 (container 2). B3 (container 3 does not get a percentage of 100. This happens on every period.
After the first period, i.e. period 2, B1, B2, and B3 all get 10% of the value of the previous B2 values divided by 3. So each container gets 1.33 in this example. However, B1 also gets another 60% of 100 added to it making the total 61.33 and B2 gets another 40% of 100 added to it making the total 41.33.
In the next period, period 3, again 10% of the values from B2 above period 3 divided by 3, i.e. ((40+41.33)*0.10)/3 gets added to all cells in period 3, then for B1, add another 60% of 100, and B2 get another 40% of 100.
ORIGINAL QUESITON:
I have the following spreadsheet which uses some basic formulas.
https://spreadsheets.google.com/spreadsheet/ccc?key=0Al-CN3-vjUYvdEdNMU4zN3FTNF9VZlMzZXBTcjh0Mnc&hl=en_US#gid=0
As you can see this goes from period 1 to 12. Is it possible to create a formula for columns B1, B2, and B3 to get the values based on the period? So, for example, if the formula was working, I would be able to simply type in 5 to get:
B1 = 65.61
B2 = 45.61
B3 = 5.61
Used = 500.00
If I type in 100 as the period, it should return the correct values, instead of creating 100 rows with the appropriate formulas per cell, which would take ages to do.
Does anyone know how to create the required formulas?
As shown online in your spreadsheet, you can use SUMIF:
For B1:
=SUMIF(C2:C13;A4;D2:D13)
And so on for B2, B3 and Used.
EDIT
I solved your issue on another Sheet of your Google Doc.
Needed some maths to found out which kind of sequence this was in order to sum up each element to the n-th one.
This was done for column E (meanly title B2):
=$A$2*$I$8*POWER($I$2/3+1;C2-1)
And then adapted to fit B1, B3 and Used, wasn't that easy...
For Ease Why dont you convert
=(((E2+E3+E4+E5+E6+E7+E8+E9+E10+E11+E12)*I2)/3)+(A2*I5)
to
=((SUM(E2:E12)*I2)/3)+(A2*I5)
Before all this math stuff isn't my best Art, but I figure out the answer anyways
Well, even when you can macro your function, some understanding of the formulae can help to a simpler answer:
First, the key column is B, if you analize his result you will identify this as a ''series'' (the math stuff, link to wikipedia here), checking of the results are calculated yield the followin table:
please, don't force to explain, because isn't my best area of expertise, but this is the solution (use a scientific calculator or mathematica to check this out), using this formulae you getthe value of the B column.
So, Column A and C, how we get it? A quick inspection show the following:
A=B+20
C=B-40
I hope this solves your question
Best Regards
Alen
Related
I am trying to get this formula to ignore the times on the data in column D and look up the date to calculate the costs per day, but can't seem to get this working.
I don't know why you are apparently trying to sum B:B from B2; that seems like a circular reference. I believe you are trying to sum E:E.
=sumifs(E:E, D:D, ">="&A2, D:D, "<"&A2+1)
Put this in B2 then drag down:
=SUMIFS(E:E,D:D,"<=" & A2 + 1 - TIMEVALUE("00:00:01"),D:D,">=" & A2)
It works by searching on less than or equal to the last second of the date in A2 (add 1 day then minus 1 second) and greater than or equal to the first second on the date in A2.
Edit: Damn I over complicated that, user11087823 has put a more appropriate answer.
You can use SUMPRODUCT as shown below:
I suggest you read about how dates and times are stored in Excel, as you will note that I used mathematics, and not string functions, to remove the time portion.
This is basically about overtime calculations, but I want it calculated separately. IF(A1>8,A1-8,0)
I want A1 when it reaches 8, to flow over to I1. Now I know this formula...
But additionally I would also like B1, C1, and D1 to do the same. So what I'm saying is that each of those cells when a value above 8 is input, I would like it to flow into I1 aswell. That's one part of it, also I would like any amount that is input to cells E1, F1, and G1 to flow into I1 . The final 3 cells are basically weekend work and considered by my company as overtime.
=SUMPRODUCT((A11:G11>H3:N3)*(A11:G11-H3:N3))
So this one works guys but, what I want to do is grab from two separate rows for the seven days of the week. Like this.....
=SUMPRODUCT((D11:G11,A13:C13>H3:N3)*(D11:G11,A13:C13-H3:N3))
But what I'm getting now is #VALUE! I'm not sure what I'm doing wrong.
I would like to know if this is possible and will greatly appreciate the help solving this problem.
So Seeming no one answered you guys decided to minus my rep, I stumbled on the answer myself. I worked this out by making a table with each day and the hours of single time in them.
For the purpose of this formula below I'll say K3 is Sunday and that D19 is also the hours worked on the Sunday. It tells the cell to compare the number input to D19 and if greater than, then minus what is in K3 and return the value in the cell I have input the formula. Because this is for overtime I wanted it to add up each day separately and give me a running total through the week. This Formula worked perfectly for me.
=SUM((D19>$K$3)(D19-$K$3),(O11>$L$3)(O11-$L$3),(P11>$M$3)(P11-$M$3),(Q11>$N$3)(Q11-$N$3),(K13>$H$3)(K13-$H$3),(L13>$I$3)(L13-$I$3),(M13>$J$3)*(M13-$J$3))
Feel free to copy and paste and change it to suit your needs.
ive been trying to break into some excel just to get a little bit familiar with the program but im a little lost on some of the prebuilt functions. Here is one of the exercises ive been attemping.
In cell B5 calculate the projected sales for January 2015. Use the Average 2014 Monthly Sales in B2 and the Growth Rate in cell B1. In cell C5, use appropriate cell referencing to calculate the projected sales for February 2015 based on the projected January sales and the Growth rate.
which function would be best suited for this ?
This would be a straight forward math problem
future amount = current amount + (current amount * percentage increase)
or simplified:
future amount = current amount * (1 + percentage increase)
in B5:
=B2*(1+B1)
Then in C5:
=B5*(1+$B$1)
And copy/drag across. The B5 reference will change appropriately and it will fill in the correct amounts across.
You want a single formula for it all:
In B5 put:
=FVSCHEDULE($B$2,INDEX(($B$1*ROW(INDIRECT("1:" & COLUMN(A:A))))/ROW(INDIRECT("1:" & COLUMN(A:A))),))
And drag across.
I prefer Scott's original answer and it works really well in in this case. I just want to expand on this as it appears to me to be a compound interest problem and finding out what the nth value of an investment is based on a fixed interest rate. So a more general equation would be:
=P*(1+i)^(n)
P - Principal or starting value
i - Interest rate for the period (not annual unless you period is annual)
n - period number, 1 for first period 2 for 2nd etc.
Scott's formula works really well because all the months are side by side and there are no gaps. This is what the OP presented to us in the example. However, if months had been missing a different approach would have been necessary.
An alternative approach using the OPs orignal setup could be:
=$B$2*(1+$B$1)^(COLUMN(A1))
B2 is the starting principal P
B1 is the interest for the period
COLUMN(A1) is a way to count the nth period as the formula is copied across.
If the date was stored in B4 and formatted to display a month, we could substitute the following for determining the nth period:
Month(B4)
Of course this assumes that the whole thing started in the first month, but an alternate form could be used to adjust the value based on a supplied starting month/date.
And of course the entire header row of month could simply be changed to an integer representing the nth period of interest
On a side note, one of the nice parts of using this method, is that it is independent of what is happening in adjacent cells. Should a column in the middle of the series be erased, you will not be faced with a series of errors.
I am trying to make data collected in 15 minute increments look like data collected in 5 minute increments with the blank spaces being zero. I have created a column with Julian date/time in 15 minute increments (A) and a column with Julian date/time in 5 minute increments (C) and the 15 minute increment data is in column B. I have created a simple formula to check all of column A for an exact match to column C if true I need it to return Column B corresponding to the match in column A, If false it can return 0.
Here is what I have so far with the ?????? being the missing True return formula. What is the formula to return the corresponding data in column B?
=IF(ISNUMBER(MATCH(C2,D:D,0)),"?????????","0")
The common way to handle this sort of lookup is using INDEX-MATCH. You may also be able to use VLOOKUP but I always prefer INDEX-MATCH.
Picture of ranges shows the 5 minute times in column C with 15 minute data in column F.
Formula in C1 is a combination of INDEX-MATCH and IFERROR. The IFERROR is used to handle the case of a value not found and returning the 0 you wanted.
=IFERROR(INDEX($F$1:$F$11,MATCH(B1,$E$1:$E$11,0)),0)
That formula can be copied down from C1 to the end of the 5-minute times.
Your sample formula looks like it uses different columns that your narrative describes. I will use what I understand from your description as the columns. See my sample image below for clarity.
Time lookups are prime candidates for 15 digit precision floating point errors. This is due to the base nature of time being a decimal portion of a day and the repeating decimals inherent with displaying 60 minutes and 24 hours. This problem is often magnified by using incremental progression vs datum growth.
If you have a base time in A2 and wish to create a series of 15 minute increments from that to fill down the column, do not use something like the following:
=TIME(0,15,0)+A2 ◄ generates incremental error growth
When you fill that formula down, any error is multiplied as you fill down. Your base display of minutes may not show any obvious errors but if it was displayed as seconds you would likely find that an extra second was added or subtracted every several hundred rows. This is known as Incremental Error Expansion where each successive row adds to the error generated by the previous formula. In short, if you have a hundred of these formulas in a column, any error in the first is multiplied by 100 by the last one.
By always basing the sequential time formula on A2, the error is minimized to a
single calculation. Change the formula to something like,
=TIME(0,ROW(1:1)*15,0)+A$2 ◄ datum growth based on minutes added to A2
Even with a datum growth formula you may have some errors on exact matches. Best to wrap the formula in an MROUND function that allows you to round off the returned value to a specified multiple; in this case to the nearest second.
=MROUND(TIME(0, ROW(1:1)*15,0)+A$2, TIME(0, 0, 1))
Fill down to get a progressive column of values with a 15 minute increment. You will likely not see any difference in the displayed values but the raw underlying value that is used for the lookup will be quite different. This principle is know as Datum Incrementing; e.g. all progressive numbers are based on a single calculation against the original.
So with a time value in A2 these are the formulas that should be used.
8:30:00 AM ◄ starting time value in A2
=MROUND(TIME(0, ROW(1:1)*15,0)+A$2, TIME(0, 0, 1)) ◄ in A3 add 15 minutes to A2 (fill down as necessary)
=A2 ◄ starting time value in C2
=MROUND(TIME(0, ROW(1:1)*5,0)+C$2, TIME(0, 0, 1)) ◄ in C3 add 5 minutes to C2 (fill down as necessary)
These will produce the most accurate time increments to be used for an exact match lookup.
Now you can apply a VLOOKUP function or an INDEX function paired with a MATCH function to retrieve the values from column B. An IFERROR function will catch non-matches and output a 0 instead of the #N/A error.
My formula in column D uses an INDEX/MATCH pair. D2 is,
=IFERROR(INDEX($B:$B, MATCH(C2,$A:$A, 0)), 0)
There is an alternate formula in E2 using VLOOKUP,
=IFERROR(VLOOKUP(C2,$A:$B, 2, FALSE), 0)
Caveat: There is a maximum number of minutes that can be applied with the TIME function. This is the maximum positive value of a signed integer or 32,767 (about 22¾ days worth of minutes).
You could eliminate the look-up altogether and just use the index function to reference the cells needed like this:
Regarding Is a comment warning enough when dealing with potential data loss? and =TIME(0,ROW(1:1)*15,0)+A$2 I caution that applied ‘liberally’ there may be the risk of loss of data. May depend on machine specifications etc. but trying to fill most of a column with that formula my Excel crashed (after attempting for most of 1-1/2 hours). I’d be interested in the experiences of others, in part because dealing with the least significant digit might be processor dependent.
On my machine I tried comparing:
=TIME(0,ROW(1:1)*15,0)+A$2
with
=TIME(0,15,0)+B2
Over 1,000 rows (ie about 10-1/2 days of quarter hours) and found differences (computed, so a possible source of further inaccuracy). The main difference being that the latter accounts for day changes (the integer part in Number format) whereas the former does not. Allowing for integer differences over 1,000 data points there were about 30 that differed by 0.00000000000003, in Number format, and a further 10 or so by much smaller amounts.
The last data point (09:45 AM on day 10) was one of those exhibiting the larger difference (though not as the accumulation of a series of smaller differences). Any difference can be enough for a failure to make an exact match but in seconds that is a difference of about 0.000000002592 by my reckoning, say ~0.0000026 milliseconds or ~26 nanoseconds.
Since in my opinion the day (integer part) is likely to be useful, I would recommend series fill by entering 0 in one cell and 00:15:00 in the next, the dragging down to suit. This has no performance impact because the cell contents are values rather than formulae. For the last entry this gives rise to a difference of 0.00000000000005, ie about twice as much as above, and in some cases as much as 0.00000000000009, about 78 nanoseconds.
With rounding to the second there are differences of a similar order of magnitude. However, a comparison on the last series fill result, with rounding to the second, with the last result from =MROUND(TIME(0, ROW(1:1)*15,0)+A$2, TIME(0, 0, 1)) using EXACT, returns “TRUE”.
Series fill of an entire column took me about 3 seconds. Then rounding to one second with a formula in another column about 12 seconds.
I'm working on developing a simulation model in Excel for a class project, and I have ran across this odd problem. My model is basically to simulate a tram path with multiple stations. To make it simpler, I have created this Excel sheet to demonstrate my model and issue:
http://i.stack.imgur.com/8qhD2.png
As you can see above, this is the information of riders who are arriving at station 1 and wanting to go to station 2, 3 and 4 respectively.
In the cells B3 to D3, I have this formula:
=ROUND(BETA.INV(RAND(), 4, 4, 0,6),0)
In the cell B4, I have this formula:
=IF($E$3>8,IF(B3=0,0,RANDBETWEEN(1,B3)),B3)
and finally, in the cells B6, I have:
=B3 - B4
Now, the tram capacity is only 8 riders at a time, so the total number in cell E4 cannot exceed 8. Is there a way I can tell Excel to do the following:
If the total number of people in cell E3 is greater than 8, then randomly select numbers of riders who can get on the tram based on the number of riders who want to go to each station so long that the total number in cell E4 does NOT exceed 8 (just as demonstrated in the screenshot above).
If the total number of people in cell E3 is less than or equal to 8, then the same number in cells B3 - D3 should carry over to cells B4 - D4.
Hopefully my explanation is clear enough. Any thoughts on how to achieve this?
I don't think excel could do that as this involves recursive iteration. One workaround is you could generate lots of test case that try to form up the 8 if it is more than 8, then you can pick the success one as your answer.
You may take a look at my implementation. Here is the Link.