How to do SUMPRODUCT with percentage and blank cells - excel

I am trying to do SUMPRODUCT in Google Sheets but in a more complicated situation.
I want to sum product with percentage instead of decimal number.
This is what I am doing now, and it works just fine:
A B C D
Price Tax Cashback
100 1.09 0.95
80 1 1
50 1.09 0.95
Total =SUMPRODUCT(B:B, C:C, D:D)
What I actually want to do is
A B C D
Price Tax Cashback
100 9% 5%
80
50 9% 5%
Total ???

Use
=SUMPRODUCT(B2:B, 1+C2:C, 1-D2:D)

Related

How to multiply B1 with C1, B2 with C2, Bn with Cn and Sum them?

This is my sheet:
Goods Type Quantity / Geram Gold Price 750K Price of Exchange
Gold 100 1,554.00 0
Silver 500 235.00 0
Euro 200 0.00 1.01
Pond 50 0.00 0.97
Gold 100 1,554.00 0
Silver 500 235.00 0
Euro 200 0.00 1.00
Pond 50 0.00 0.99
I want to do to this:
If Goods Type is Gold: multiply Quantity / Geram by Gold Price.
In my case it should be: (100 * 1554) + (100 * 1554) = 310800, and if I add more entries in the future, it should add more.
I have this cell in my current sheet: If Goods Type is Gold, then sumif all Quantity / Geram in another cell which is now 200.
Use SUMPRODUCT: sumproduct
=SUMPRODUCT((A2:A9="Gold")*B2:B9*C2:C9)
It multiplies TRUE/FALSE (result of A2:A9="Gold") with quantity and price and sums everything (in this case = 155400 + 0 + 0 + 0 + 15540 + 0 + 0 + 0))
Result:
Adjust ranges to your data.
You can make a SumProduct() for three columns, so you can create an IF() formula for getting 1 in case of "Gold" and 0 else. This leads to following kind of formula:
=SUMPRODUCT(IF(A2:A6="Gold",1,0),B2:B6,C2:C6)
See following screenshot:

How to calculate average price of open position of stocks Excel Table

I have a simple table with some dummy data to simulate stock trades. I know the its model is not exactly right, but it does comply with the basics and that's what I'm looking for.
The answer I'm looking for is how would I calculate the data on column 12. It's supposed to show the Average Price of the position at that date. If the position opened with the current row then the average price is the actual price of the trade, however the position can be increased or decreased with new prices and I want to know the average price up to that date (last two rows have this example).
Column 13 (What I got so far) has this definition*: =SUMPRODUCT([Delta Position];--([Date Trade]<=[#[Date Trade]]);--([Position After Trade]=[#[Position After Trade]]))
*actually the there's two more columns, Trader and Maturity Date, these two are used to filter data and are not shown to make it more readable: --([Person]=[#Person]);--([Month]=[#month])
(second row just shows the definition of the simpler columns)
Date Trade
Price
op
Qty
Total
Accumulated Before
Accumulated After
Position After Trade
Qty Delta Position
Delta Position
Value of Open Position
What I got so far
Average Price Open Position
C1
C2
C3
C4
C5 = C2 x C4
C6
C7
C8
C9
C10 = C9 * C2
C11
C12
C13 = C11 / C7
2021-12-06
328
Buy
99
32472
0
99
long
99
32472
HELP: 32472
32472
328
2021-12-13
291
Sell
99
28809
99
0
zero
0
0
HELP: 0
0
0
2022-01-31
190
Sell
120
22800
0
-120
short
-120
-22800
HELP: -22800
-22800
190
2022-02-14
165
Buy
120
19800
-120
0
zero
0
0
HELP: 0
0
0
2022-04-20
113,7
Sell
200
22740
0
-200
short
-200
-22740
HELP: -22740
-45540
113,7
2022-06-21
74,333
Buy
300
22299,9
-200
100
long
100
7433,3
HELP: 7433.3
39905,3
74,333
2022-08-16
86
Buy
50
4300
100
150
long
50
4300
HELP: 11733.3
44205,3
78,222
The average price of an open position is calculated by this fórmula
Average price fórmula
Iteratively you can obtain this fórmula:
Iterative fórmula
First row (first operation) => Average price = M3 = If(C3='Buy';B3;-B3)
Second row => Average price => Average price = M4 = ((M3F4)+(If(C4='Buy';B4C4;-B4*C4) )) / G4
Next rows you only have to iterate fórmula.
I hope this can help you.

Excel How to make a formula differenciate different vehicle plates

I have little knowlage of excel and I'm trying to configure an excel table so I can get the consumption of gas for each vehicle in a company, but all the data is introduced in only one table, how can I calculate the increase of km's of each vehicle to then be able to calculate the consumption?
The problem is that I don't know how to make the formula differenciate for each different plate.
The table is the following:
**A B C D E F G**
**1** Date Plate km Gas Signed Increased km's Consum
**2** 1/1/2018 0157-AAA 123456 50 YES
**3** 5/1/2018 0157-AAA 123789 20 NO
**4** 8/2/2018 0157-AAA 123987 30 NO
**5** 1/2/2018 0582-BBB 123456 40 YES
**6** 1/3/2018 0356-CCC 123456 30 NO
Another exemple:
Data Plate km Gas Increased km Consum %
3/5/2017 1111-AAA 150 20 150 13,33333333
7/5/2017 1111-AAA 400 30 250 12
7/5/2017 2222-BBB 50 10 50 20
7/5/2017 3333-CCC 20 5 20 25
10/5/2017 2222-BBB 200 30 150 20
Each plate is a different vehicle
Gas is the amount of oil that the vehicle refills in L
The table is updated daily or every 2-3 days as it's manually filled
The problem is calculating the increased km's as they may be other plates in between in the same date.
Consum % = Gas/Increased km *100
I thought about just ordering the columns by date and by plate and apply a general formula to everything
Thanks
I think I finally "solved my problem", the formula with the one I work is based on a filter for the plates in order to get them ordered. then the formula is:
Increased km =IF(B2=B1;C2-C1;C2)

Return values in same row by searching different column

Given data like this:
A B C D
1 MAX. Time MIN. Time
2 140 08:00 100 01:00
3 150 15:00 50 02:00
4 130 17:00 80 03:00
5 120 22:00 90 04:00
=MAX(A2:A5) will return 150 and
=MIN(C2:C5) will return 50
How can I find the values in COL B in same row as 150 (for MAX) and in COL D in the same row as 50 (for MIN)?
If you can confirm that you have only one max(min) value (if not, formula returns first occurance), you can simply use VLOOKUP:
=VLOOKUP(Max(A2:A5),A2:B5,2,0)
for min formulaa would be the same:
=VLOOKUP(Min(C2:C5),C2:D5,2,0)
Alternatively you can use more flexible formula:
=INDEX(B2:B5,MATCH(Min(C2:C5),C2:C5,0))
above formula finds min in column C and returns corresponding value from col B

Percentage graph from absolute values

I have the following data:
Date A B C
2012/07 7 6 0
2012/08 9 4 0
2012/09 9 3 0
2012/10 14 2 1
2012/11 9 16 0
2012/12 0 14 0
2013/01 7 9 1
2013/02 8 13 1
2013/03 16 62 16
2013/04 7 12 4
2013/05 10 11 1
2013/06 6 37 4
I want to make a line graph from these data, but I want it to show percentages of line total (A + B + C) instead of the absolute values. How can I do this directly, without resorting to intermediate cells where I'd insert formulas to calculate the percentages or adding a line total column?
So the end result should look like this:
But I don't want to have to "manually" create cells like these:
A B C
2012/07 54% 46% 0%
2012/08 69% 31% 0%
2012/09 75% 25% 0%
2012/10 82% 12% 6%
2012/11 36% 64% 0%
2012/12 0% 100%0%
2013/01 41% 53% 6%
2013/02 36% 59% 5%
2013/03 17% 66% 17%
2013/04 30% 52% 17%
2013/05 45% 50% 5%
2013/06 13% 79% 9%
Use Named Ranges.
First, define the name "Total" as =B2:B12+C2:C12+D2:D12
Then, define three names "PctA"=B2:B12/Total, PctB etc.
Then, define a name "Dates"=A2:A12
Insert a line chart and enter the 3 pct names as the data series. Put in the names as Sheet1!PctA, etc. - Excel won't accept the names without a sheet reference.
Do same for Dates as the horizonal category range.

Resources