Combine AGGREGATE and SUBOTAL function - excel

0
A
B
C
D
E
1
Product
Revenue
3280
#NA
2
Product A
500
3
Product A
#NA
4
Product B
600
5
Product C
700
6
Product C
900
7
Product C
#NA
8
Product D
9
Product D
10
Product C
580
C1 =AGGREGATE(9,6,B2:B9)
D1 =SUBTOTAL(9,B2:B9)
In Cell E1 I want to filter the list and ignore the #NA and empty cells.
I assume that somehow I need to combine the AGGREGATE and SUBTOTAL function but I have no idea how to do this.
Do you know how it is possible?

Don't need to combine anything. Use AGGREGATE function, but instead of "Option" parameter 6, use 7 - "Ignore hidden rows and error values".
Formula:
=AGGREGATE(9,7,B2:B11)
Result:

Related

EXCEL Sum up points based on placements (combine VLOOKUP and SUM)

e.g. I have a list of race results:
A B C D E F...
NAME P. RACE1 RACE2 RACE
abc =? 1 3 3
bcd 3 2 4
cde 4 4 2
def 2 1 1
and another sheet with points for each result:
A B
PLACE POINT
1 10
2 5
3 2
4 1
Is it possible to get the total points in sheet1 column B based on the race results in column C-E..?
Is it a connection from VLOOKUP and SUM?
Yes, that's possible. You can use a SUMPRODUCT formula for that. You may use this one in column B:
=SUMPRODUCT((C2:E2=$A$13:$A$16)*$B$13:$B$16)
Your result will look like this:
This is an array function. The term C2:E2=$A$13:$A$16 will check for race 1 to 3 if it was 1st, 2nd, 3rd or 4th place. This will result in an "imaginary" array of TRUE and FALSE. For name "abc", it will look like that.
Those results are then multiplied with the points from B13:B16 and the sum is formed.
In Excel O365, one could use:
Formula in B2:
=SUM(VLOOKUP(C2:E2,H$2:I$5,2))

HLOOKUP/VLOOKUP to replace nested IF-functions

I have the following Excel spreadsheet:
A B C D E
1 Sale 1 Sale 2 Sale 3
2 Product A 0 0 400 Sale 3
3 Product B 0 0 300 Sale 3
4 Product C 0 200 0 Sale 2
5 Product D 800 0 0 Sale 1
In Columns B:D you can see the Sales for each product.
In Column E I want to show in which Sale the product was sold.
Therefore, the Sale which is <> 0 should be shown.
I used the following formula so far:
=IF(B3<>0,B$2,WENN(C3<>0,C$2,WENN(D3<>0,D$2)))
This formula works in the upper case quite well but in my orignal example there are much more sales which would expand this formula massively.
Is there a way to shorten the formula so it is not necessary to use so many nested IF-functions?
Maybe somethling like a HLOOKUP with a value <> 0 criteria?
Following formula should be helpful:
=INDEX($B$1:$D$1,MATCH(TRUE,INDEX($B2:$D2<>0,),0))
Drag/Copy down as required.
See image for reference:

SUMPRODUCT with multiple criterias and empty cells

I have the following Excel spreadsheet:
A B C D E F G
1 Profit 1.Sales 2.Sale 3.sale
2 Product A 50 500 600 0 Product A 110
3 Product A 60 0 400 0 Product B 90
4 Prodcut A 20 0 0 0 Product C 130
5 Product B 90 800 0 500
6 Product C 80 0 0 400
7 Product C 50 300 750 200
8 ="" ="" ="" ="" =""
In Column A different products are listed. It can happen that the same products appear several times in the list. In Column B you can find the budgeted profit for each product and in Columns C:E the different sales of each product.
In Column G the sum of the profit of each product is shown in case the product has any sales. For example Product A has no sale in Row 4; therefore the sum of its profit is B2+B3 = 110.
I use the following formula to get the sum of the profit:
G2 = SUMPRODUCT($B$2:$B$7*(($C$2:$C$7>0)+($D$2:$D$7>0)+($E$2:$E$7>0)>0)*($A$2:$A$7=F2))
This formula works perfectly so far.
However, now I want to expand this formula to Row 8.
Row 8 does include =" " which causes a result of #VALUE! of the above formula.
How can I make this formula work despite the =" " in Row 8?
Try SUMPRODUCT() with two arguments:
=SUMPRODUCT($B$2:$B$8,(($C$2:$C$8>0)+($D$2:$D$8>0)+($E$2:$E$8>0)>0)*($A$2:$A$8=F2))

SUMIF(S) with a SUMIF(S) criteria

I have the following Excel spreadsheet:
A B C D E F G
1 Budget Profit 1.Sales 2.Sale 3.sale
2 Product A 50 500 600 0 Product A 100
3 Product A 50 0 400 0 Product B 90
4 Prodcut A 20 0 0 0 Product C 180
5 Product B 90 800 0 500
6 Product C 90 0 0 400
7 Product C 90 300 750 200
In Column A different products are listed. It can happen that the same products appear several times in the list.
In Column B you can find the budgeted profit for each product and in Columns C:E the different sales of each product.
In Column G I want to achieve now that the sum of each product is calculated but only if the sum of the sales (Columns C:E) is >0 or - in other words - if there is any sales for the product the profit should be summed up.
So far I came up with something like this:
=SUMIFS($B$2:$B$7;$A$2:$A$7;F2;$C$2:$E$7;">"&0)
However, this formula does not seem to work. I get an #VALULE! error.
Do you have any idea how I could make this happen?
The SUMIFS() ranges need to be the same size, And since you want OR Not AND You will need to use SUMPRODUCT:
=SUMPRODUCT($B$2:$B$7*(($C$2:$C$7>0)+($D$2:$D$7>0)+($E$2:$E$7>0)>0)*($A$2:$A$7=F2))

SUMPRODUCT with OR criterias

I have the following Excel spreadsheet:
A B C D E F G
1 Profit 1.Sales 2.Sale 3.sale
2 Product A 50 500 600 0 Product A 110
3 Product A 60 0 400 0 Product B 90
4 Prodcut A 20 0 0 0 Product C 130
5 Product B 90 800 0 500
6 Product C 80 0 0 400
7 Product C 50 300 750 200
8 ="" ="" ="" ="" =""
In Column A different products are listed. It can happen that the same products appear several times in the list. In Column B you can find the budgeted profit for each product and in Columns C:E the different sales of each product.
In Column G the sum of the profit of each product is shown in case the product has any sales. For example Product A has no sale in Row 4; therefore the sum of its profit is B2+B3 = 110.
I use the following formula to get the sum of the profit:
G2 = SUMPRODUCT($B$2:$B$8,(($C$2:$C$8>0)+($D$2:$D$8>0)+($E$2:$E$8>0)>0)*($A$2:$A$8=F2))
This formula works perfectly so far.
However, now I want to change this formula to only count in the Products that have a Sale > 500 so I modified the above formula to the following:
G2 = SUMPRODUCT($B$2:$B$8,(($C$2:$C$8>500)+($D$2:$D$8>500)+($E$2:$E$8>500)>500)*($A$2:$A$8=F2))
With this formula I get a value of 0 instead of 50 for Product A.
Where is my mistake in the formula?
Use Formula Auditing ► Evaluate Formula to examine what is happening at each step.
= SUMPRODUCT($B$1:$B$7,((($C$1:$C$7>500)+($D$1:$D$7>500)+($E$1:$E$7>500))>0)*($A$1:$A$7=F2))

Resources