Average of two columns sum in excel - excel

I have two columns, for example:
A(10,15,30) and B(2,3,No data)
And I need average: sum(a)/sum(B) but without sum any cell in A column if cell in the same row of B column is empty. I need a formula for this...
Based on this example, I'm looking for a formula which will give me average 5((10+15)/(2+3)), not 11((10+15+30)/(2+3)).

Use this:
=SUMIF(B:B,"<>",A:A)/SUM(B:B)

Related

Sum the result of every 2 rows, if the result is negative

I have a single column of numbers, I need to sum row 1 and row 2, sum row 3 and row 4, all the way to the end of column. And then, I need to sum all the previous result if the result is negative only.
I can only do this series of adding without creating more columns because I have to to this for many columns and I don't want to create another column to store the sub result as that will double the number of columns.
Any way I can achieve this with excel formula? Thanks.
In B2, formula copied down :
=IFERROR(1/(1/SUM(OFFSET($A$1,(ROW(A1)-1)*2+1,0,2))),"")
Edit #.1
In A10, enter formula :
=SUMPRODUCT(0+TEXT((A2:A8*MOD(ROW(A2:A8)-1,2))+(A3:A9*MOD(ROW(A2:A8)-1,2)),"\0;-0"))
another SUMPRODUCT version:
=SUMPRODUCT(--TEXT(ISEVEN(ROW(A2:A8))*(A2:A8+A3:A9),"\0;-0;0"))

How to sum corresponding values with same month and names of two columns in Excel?

The formula should sum up the column C based on Column A and B when two column value matches and displays the sum value only in the first cell D2 of Column D as shown in figure "60" & "67".
I am trying with SUMIFS but not getting the Output as required.
=SUMIFS(C2:C6;A2:A6;"A:A";B2:B6)
Try this formula in cell D2:
=IF(SUMPRODUCT(--($A$2:$A2&$B$2:$B2=$A2&$B2))=1,SUMPRODUCT(--($A$2:$A$6&$B$2:$B$6=$A2&$B2),$C$2:$C$6),"")
It should give expected output.
It might also be better/more efficient if you create a helper column (which stores concatenation results, instead of doing the concatenation multiple times in each formula).

Excel formula to calculate the sum of the first n% visible rows in a filtered column

As I stated in the title, I want to calculate the sum of the first n% rows in a filtered column. The total numbers of rows in the column varies due to the filtering options, so my formula must work with different values of n.
For example :
In column A, I have 10 rows that contain values from 10 to 1 ( I sorted them from largest to smallest ).
In column B, I have 10 corresponding rows that contain 2 names: 4 of them contain the value "Tom", six of them contain the value "Jerry". When I filter the whole table and select only the rows that contain the value "Jerry", I want to be able to calculate the sum of the first 20% of the corresponding 6 number values.
This could work without any filtering if you want.
With criteria for column B in E1 and percentage you looking for in F1 with the assumption we want to round up the percentage to integers.
So formula in D1:
=SUMPRODUCT(LARGE((B2:B11=E1)*(A2:A11),ROW(A1:INDEX($A:$A,ROUNDUP(COUNTIF(B2:B11,E1)*F1,0)))))
So, without your data, I came up with this, edit to suit your situation...
So, based on the comment, I did a second version:
The helper column in col C is used with sumproduct to give the result...
You can use the percentile function in AGGREGATE with SUMIFS to do what you want:
=SUMIFS(A:A,B:B,"Jerry",A:A,">="&AGGREGATE(16,7,A1:A10/(B1:B10="Jerry"),0.8))
If you want to use the filter to do the decision:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(A1,ROW(A2:A10)-1,,1))*(A2:A10>=AGGREGATE(16,7,A2:A10,0.8)),A2:A10)

Excel formula to match two columns and use sum function to subtract corresponding values

Excel Screenshot
The formula should lookup value from column A in column D and then the corresponding values should be subtracted in G1 and so on.
thanks.
Try this:
=$B1-VLOOKUP($A1,$D:$E,2,0)

Excel: Formula or function to sum up the column values starting from a certain row

Is there a way (formula or function) in Excel (using AB or RC format) to sum the column values from a certain row (say row 5) and beyond?
I am trying to place a totals row (say on row 2) above the header (which is on row 4), and each column in the totals row displays the sum of the respective column - all rows from row 5 (which is after the header).
Your help is appreciated.
It's unclear why a simple SUM function won't work here. If you want to be fancy, try something like the following.
=sum(a5:index(a:a, match(1e99, a:a)))
Fill right as necessary.
Assuming I understand your question, so why don't you just write (in location X2, i.e. column X row 2)
=SUM(X5:X25)
Which will give you the sum of column X rows 5 to 25
Does SUBTOTAL solve your issue?
=SUBTOTAL(9, B5:B1000)
9 code for SUM
B5 is the the first cell after the header
You can use the offset function for things like this
=SUM(OFFSET(A2,3,0,995))
where the 995 is the number of rows you want to sum. You can use a count() or something instead of hardcoding it.

Resources