I have a problem in Excel. I'm making a program to monitor the consumption of fuel per month. As I do not tank fuel every day, but only every couple days I'd like the program to measure aritchmetic mean for me.
This means it would take the last input and count all blank cells above (excluding my previous input) and measure the mean of fuel consumption in these days.
Example of how it should work:
[link to image] http://i64.tinypic.com/2dre87m.jpg
Edit: If anybody knows how to count number of empty cells between 2 inputs it would also suffice to me.
I was able to get your desired results using an array formula. Assuming your headings Day,Fuel, and Average are in cells A1, B1, and C1 respectively; copy and paste the following formula in cell C2 hit CTRL+SHIFT+ENTER and drag the formula down your column.
=IFERROR(IF(B2="","",(B2/(LARGE(IFERROR(MATCH($B$2:B2,$B$2:B2,0),""),1)-LARGE(IFERROR(MATCH($B$2:B2,$B$2:B2,0),""),2)))),B2)
It gave me a "formula omits adjacent cells" error, but we want to omit the cells below the target row on purpose, so just ignore the error. Hope this helps.
Try this formula:
=IF(B2="","",ABS(B2/(MATCH(0,B$2:B2,-1)-SUM(MATCH(0,B1:B$2,-1)))))
in C2 and copy down.
if cells in column B can contain string values then you can use this formula:
=IF(ISNUMBER(B2),ABS(B2/(MATCH(0,B$2:B2,-1)-SUM(MATCH(0,B1:B$2,-1)))),"")
Related
I need to sum Amount for all the dates if there is value in India row:
I tried implementing with COUNTIF function but its not solving my problem, any suggestion welcome, I am pretty new to Excel formulas.
Try this.
Let's assume the top left cell on your image is cell "A1". Go to cell "C6" and paste the following formula:
=IF(C2>0,C2*(SUM(C4:C5)),"")
Now fill/copy that formula across to cell "G6". Then go to cell "H6" and paste the following formula:
=SUM(C6:G6)
Hope this helps.
What about this:
=SUMPRODUCT(C2:E2+C3:E3,C4:E4+C5:E5)
It's basically adding the two first rows, adding third and fourth rows, and taking the sumproduct. Obviously, you need to make sure not have a number in both rows one and two, and in both rows three and four.
So I've got a column of data that I want to count the non blank cells after a certain row.
Here's an example of what I have:
So, in this example, I would like to start counting non blank cells in column A starting on row 13 (which would be a total of 4). If you look at the formula I have entered into cell D12 I can get the value I'm looking for with this formula:
=COUNTA(A:A)-11
I could use this formula:
=COUNTA(A13:A16)
but the point is the last cell with data in it can change due to entering different amounts of data in the column.
But I'm wondering if there is a different formula I could use that would count non blank cells from a certain row down regardless of the amount of data I enter into the column from a certain row down using an open ended range, kind of like this:
=COUNTA(A13:A)
This formula doesn't work but it kind of illustrates what I tried to do that didn't work.
from my comment above:
Well, you could always get the last used row dynamically and incorporate that, not sure what your benefit is over using the last row:
=COUNTA(A13:INDEX(A:A,LOOKUP(2,1/(A:A<>""),ROW(A:A))))
This makes it somewhat "open" ended I guess. Unfortunately it isn't GS =)
I had a table in excel where prices of products are written in US Dollars. I want to change these cells to Euros and some markup so I had to multiply all these cells with a constant cell which contains something like this =0.86*1.03*1.15.
The problem is I had to keep initial US Dollar amount on the formula because I had to change this constant cell regularly due to currency and markup changes. So every time I change it, it has to multiply with the initial amount.
I tried to set multiply formula to each cell but there are too many to write it every cell the same formula. Is there any option to set a formula to apply all those cells where multiplies initial amount with the constant cell?
So, you should do something like this, assuming the constant is in cell A1 and the prices in cells A5 onwards.
In cell B5 enter:
=$A$1*A5
and drag down as far as needed.
Edit, based on comments: if the values are in an existing table, then the calculations could be performed in a helper column then copy / pastevalues back over the original prices...
I have a spreadsheet with 4 columns : A, B, C, D.
I want to calculate the difference between A-B and C-D. So in cell E2 I enter the formula =A2-B2 , and get the result that I want, which is the difference between A-B.
Now I drag the formula in E2 to cell F2, expecting that Excel will "think" that now I want the difference between C-D. However, when I drag the formula from column E to column F I get =B2-C2 (you see, Excel assumes I want to use B2 again).
My question is: how can I make Excel “understand” that I want to use =C2-D2 after =A2-B2, and NOT =B2-C2?
This an abbreviated example. The original data-set has hundred of columns. Thanks for your help.
Enter Formula in E2
Drag the formula up till G2. Now G2 will have the formula which you want.
Delete Col F. Now Col G will move to Col F, which will have your required formula
There's no way in the UI that you get Excel to "think" that much - it'll only shift the references by one column if you drag it across. If deleting the columns in between is not an option, you need to rewrite you formula, e.g.:
=OFFSET(A1,0,COLUMN(L1)-COLUMN($L1))-OFFSET(B1,0,COLUMN(L1)-COLUMN($L1))
In this example, it is assumed that you start showing the difference in column L - of course you need to adjust according to your worksheet - but once done, you can drag the formula to the right as far as you need.
As your original data-set has hundreds of columns, you may want to use a non-volatile formula, eg:
=INDEX(A1:K1,1+COLUMN(L1)-COLUMN($L1))-INDEX(A1:K1,2+COLUMN(L1)-COLUMN($L1))
This will speed up calculations in the workbook. Depending on how big the data-set is and how many other formulas are in the workbook, the difference in speed could be enormous.
The same conditions apply as in Peter's example.
I’m a designer. I have a list of tasks, with hours, and I’ve split them into milestones. I want to count the number of hours for each milestone.
Here’s a picture:
In other words: I want to look at the value in the M column, if it’s 1, I want to get the cell across it, then repeat down the rows, and sum the whole lot.
See if you can figure that one out with the least cell wastage! :) (This is Numbers for Mac, so no macros or vbscript or what-have-you.)
In Excel the SUMIF formula can be used.
Assumption: In picture above, the 'Hours' label is in cell A1
The formula for 'Milestone 1' in cell E2 would be:
=SUMIF($C2:$C11,RIGHT(E1,1),$A2:$A11)
The syntax of the formula is:
=SUMIF(range, criteria, sum range)
The criteria is determined by using the last character in the 'Milestone' heading.