Im struggling to get a formula to work for the following any help apreciated.
Eg. AB DD match with DD AB lowset value of the matched pair is DD AB 1.29 and result in Column 4
The Pairs are always opposing.
| Column 1 | Column 2 | Column 3 | Column 4 |
AB DD 2.34 0
XC TT 0.34 1
ST HU 3.57 0
DD AB 1.29 1
TT XC 1.01 0
Assuming data in A1:C5, in D1:
=N(C1=MIN(MINIFS(C$1:C$5,A$1:A$5,CHOOSE({1,2},A1,B1),B$1:B$5,CHOOSE({1,2},B1,A1))))
and copied down as required.
Note that this also assumes that a 'pair' exists for every entry.
Related
I have a dataset in excel, like this and I need to do a match for doing the matrix but I don't know how to do, I can't order (my real dataset it's more complicated than this)
I would like to have an array that multiplies data that are similar to each other. In this case A = A and aa = aa as a condition to then make the final matrix, ideas?
I have used match but it does not execute the function correctly
Try using SUMPRODUCT() Function --> Simply multiplies arrays together and returns the sum of products.
• Formula used in cell K2
=SUM(($A2=$G$2:$G$5)*($B2=$H$2:$H$5)*(C2*$I$2:$I$5))
And Fill Down & Fill Right !!!
Try this:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
Condition 1
Condition 2
Condition 1 & Condition 2
Machine 1
Machine 2
Machine 3
Index 1
Index 2
Index 1 & Index 2
Timeprod
Machine 1
Machine 2
Machine 3
A
aa
=A2&B2
0,2
1
0
B
aa
=H2&I2
0,5
=VLOOKUP($C2,$J:$K,2,FALSE)*D2
=VLOOKUP($C2,$J:$K,2,FALSE)*E2
=VLOOKUP($C2,$J:$K,2,FALSE)*F2
B
aa
=A3&B3
1
2
0
D
bb
=H3&I3
1
=VLOOKUP($C3,$J:$K,2,FALSE)*D3
=VLOOKUP($C3,$J:$K,2,FALSE)*E3
=VLOOKUP($C3,$J:$K,2,FALSE)*F3
C
bb
=A4&B4
0
0
0
C
bb
=H4&I4
2
=VLOOKUP($C4,$J:$K,2,FALSE)*D4
=VLOOKUP($C4,$J:$K,2,FALSE)*E4
=VLOOKUP($C4,$J:$K,2,FALSE)*F4
D
bb
=A5&B5
0
0
6
A
aa
=H5&I5
0,2
=VLOOKUP($C5,$J:$K,2,FALSE)*D5
=VLOOKUP($C5,$J:$K,2,FALSE)*E5
=VLOOKUP($C5,$J:$K,2,FALSE)*F5
How do I do this is excel. The example is provided below. If we don't sell any products on a specific day I would like to move those hours to the next date.
If you need to compute partial sums of Hours for all the consecutive rows between rows that satisfy the condition that the value Sold is greater than zero, you could do this with an auxiliary column
A B C D
---------------------------------
1 |Hours Sold Sums Solution
2 | 300 30 300 300
3 | 30 0 300 0
4 | 0 0 300 0
5 | 30 0 300 0
6 | 300 50 660 360
7 | 23 0 660 0
8 | 100 25 783 123
Here Sums is defined by a formula for C2
=IF(B2>0,SUM(A2:$A$2),C1)
You can automatically populate the cells below.
This formula puts in a cell a partial sum of Hours up to the current row if Sold is nonzero, otherwise copies the previous partial sum of hours. We need this to subtract this value on the next step.
When you have the column C filled, it is sufficient to put the following formula in D2 and populate the cells below
=IF(ROW(B2)>2,IF(B2>0,C2-C1,0),C2)
This formula handles correctly both D2 that does not have a preceding row with values and the remaining cells in column D.
In fact you could combine the two formulas together and avoid the need to have an auxiliary column. Put the following formula in C2 and spread it down to the rest of the cells in column C
=IF(ROW(B2)>2,IF(B2>0,SUM(A2:$A$2)-SUM(C1:$C$2),0),A2)
to get
A B C
---------------------------------
1 |Hours Sold Solution
2 | 300 30 300
3 | 30 0 0
4 | 0 0 0
5 | 30 0 0
6 | 300 50 360
7 | 23 0 0
8 | 100 25 123
Fill the 0s with the following conditions:
If there is one 0 value, do a simple average between the data after and before the 0. In this scenario 0 is replaced by mean of A and B
If there are two consecutive 0s, fill the first missing value with data from previous period and doing a simple average between the data after and before the second 0. First 0 is replaced by A and second 0 by mean of A and B.
If there are 3 consecutive 0s, replace first and second 0 with A and 3rd by mean of A and B.
Ticker is an identifier and would be common for every block(can be ignored). The entire table is 1000 rows long and in no case consecutive 0s would exceed 3. I am unable to manage scenario 2 and 3.
ID
asset
AA
34861000
AA
1607498
AA
0
AA
3530000000
AA
3333000000
AA
3179000000
AA
4053000000
AA
4520000000
AB
15250209
AB
0
AB
14691049
AB
0
AB
5044421
CC
5609212
CC
0
CC
0
CC
3673639
CC
132484747
CC
0
CC
0
CC
0
CC
141652646
You can use interpolate per group, on the reversed Series, with a limit of 1:
df['asset'] = (df
.assign(asset=df['asset'].replace(0, float('nan')))
.groupby('ID')['asset']
.transform(lambda s: s[::-1].interpolate(limit=1).bfill())
)
output:
ID asset
0 AA 3.486100e+07
1 AA 1.607498e+06
2 AA 1.765804e+09
3 AA 3.530000e+09
4 AA 3.333000e+09
5 AA 3.179000e+09
6 AA 4.053000e+09
7 AA 4.520000e+09
8 AB 1.525021e+07
9 AB 1.497063e+07
10 AB 1.469105e+07
11 AB 9.867735e+06
12 AB 5.044421e+06
13 CC 5.609212e+06
14 CC 5.609212e+06
15 CC 4.318830e+06
16 CC 3.673639e+06
17 CC 1.324847e+08 # X
18 CC 1.324847e+08 # filled X
19 CC 1.324847e+08 # filled X
20 CC 1.393607e+08 # (X+Y)/2
21 CC 1.416526e+08 # Y
Ok, compiling the answer here with help from #jezrael and #mozway
df['asset'] =df['asset'].replace(0, float('nan'))
df.loc[mask, 'asset'] = df.loc[mask | ~m, 'asset'].groupby(df['ID']).transform(lambda x: x.interpolate())
df.ffill()
Suppose i need to multiply the entries in these two columns in the following order in MS Excel
This is just an example
A | B
1 | 5
2 | 10
3 | 15
4 | 20
bolck1:1*5
block2:(2*5)+(1*10)
block3:(3*5)+(2*10)+(1*15)
block4:(4*5)+(3*10)+(2*15)+(1*20)
how would i do it?
I used SUMPRODUCT(A4:A1,B4:B1) but it returned the same old sum 150 as was the case with SUMPRODUCT(A4:A4,B1:B4).
You could add a helper column. In C1 put:
=SUMPRODUCT(A1*INDEX($B$1:$B$4,1):INDEX($B$1:$B$4,COUNT($B$1:$B$4)-(ROW(1:1)-1)))
Drag it down then total the results:
I often need to search through columns to find the match to values and then return the according value.
My issue is that INDEXand MATCHalways return the first value in the column.
EX. I got 7 car dealers and this is the sales last month. Oslo and Berlin sold the same ammount and INDEX(D:E,MATCH(B1,E:E,0),1)) in column C will return the first hit from column D.
A B C D E
rank Sales Delaer
1 409 London | Tokyo 272
2 272 Tokyo | London 409
3 257 Hawaii | oslo 248
4 255 Stockholm | numbai 240
5 248 Oslo | Berlin 248
6 248 Oslo | hawaii 257
7 240 Numbai | Stockholm 255
At the moment my best solution is to first find the row each value in B got in E with MATCH(B1,E:E,0) and add that to a new column (column F). Then I can add another formula in the next column, which is what I currently have to do:
=IF(F2=F1;MATCH(F2;INDIRECT("F"&(1+F1)):$F$7;0))+F2
Is there a better approach at this?
In B2 use the following standard formula,
=IFERROR(LARGE(E$2:E$8, ROW(1:1)), "")
Fill down as necessary.
In C2 use the following standard formula,
=INDEX(D$2:D$8, AGGREGATE(15, 6, ROW($1:$7)/(E$2:E$8=B2), COUNTIF(B$2:B2, B2)))
Fill down as necessary.
[Optional] - Repair the ranking in column A.
In A2 use the following formula,
=SUMPRODUCT((B$2:B$8>=B2)/(COUNTIFS(B$2:B$8, B$2:B$8&"")))
Fill down as necessary.