Excel Conditionally SUM rows totals - excel

I have an excel like this:
I want to sum the totals by when (month), type and if it's in the budget. For example I want a result like this:
So... it "search" for every when with the same month, multiply the ammount but "in budget" column, and in sums everything by type that matches that.
I hope I explained well!! I think the result image will help!
Thanks a lot in advance!!

If you are prepared to generate another column (here: F) into your workbook like
A B C D E F
1 when curr type amnt budg
2 2 U F 85 1 F21
3 2 U T 50 1 T21
4 2 U T 150 1 T21
5 2 U T 380 1 T21
6 3 U G 600 1 G31
7 3 Y G 250 1 G31
8 6 U T 600 1 T61
9 9 U T 500 0 T90
[F2] = C2 & A2 & E2
[F3] = C3 & A3 & E3
...
Then you can do the sums with:
[A12] = sumif($F$2:$F$9, "F21", $A$2:$A$9) ' for when=2, type="F" and "in budget"
[A13] = sumif($F$2:$F$9, "T21", $A$2:$A$9) ' for when=2, type="T" and "in budget"
...

Related

Matrix and match

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

Excel Formula across worksheets: If a=x, b=y then c=z

I started off using
=IF(AND(A1="this",B1="that"),"x","")
=IF(AND('[Employee Emails.xlsx]Alpha Order'!$A$2=A2,'[Employee Emails.xlsx]Alpha Order'!$B$2=B2, ???? > THEN I want it to pull the next cell '[Employee Emails.xlsx]Alpha Order'!$C$2 into C2. So C2 would display the email address.
Hopefully if firstname & lastname match, then it pulls the email address into the new cell. Otherwise I have to manually look them up & copy & paste into the new workbook.
I think this is what you want:
=IF(AND('[Employee Emails.xlsx]Alpha Order'!$A$2=A2,'[Employee Emails.xlsx]Alpha Order'!$B$2=B2), '[Employee Emails.xlsx]Alpha Order'!$C$2,"")
Though you may also want to look into VLOOKUP and INDEX/MATCH
If this were your data:
A B C D E F G
1 A G 1 A G
2 B H 2 C I
3 C I 3 D K
4 D K 4
5 E L 5
6 F M 6
In G1 you'd need this array formula (applied with Ctrl+Shift+Enter):
=INDEX($D$1:$D$6,MATCH(F1&G1,$B$1:$B$6&$C$1:$C$6,0))
And it would produce this:
A B C D E F G
1 A G 1 A G 1
2 B H 2 C I 3
3 C I 3 D K 4
4 D K 4
5 E L 5
6 F M 6
Hopefully you'll find this helpful.

PowerPivot field of same Row in Calculation

Im trying to have a formula, that gets the first result of entry, for every line.
An Example Table would be like this:
Column A Column B Column C Excepted Output from Formula
3 99 P 18 P 4
4 88 P 144 P 1
2 77 P 2
2 77 P 2
1 88 P 1 P 1
1 99 P 4 P 4
2 44 P 5
3 22 P 7
1 88 P 99 P 1
Now, on Column D it should always show the first time it finds Coulmn A = 1, and Column B the same value as the own row (99 for the first row, 88 for the second, 77 for the 3rd...), and Display the Column C of it.
I tried it with the following Formula:
=CALCULATE(
FIRSTNONBLANK('Table'[Column C]; TRUE());
FILTER('Table';'Table'[Column A]=1);
FILTER('Table';'Table'[Column B]='Table'[Column B])
)
Which doesnt work. No errors, but it ignores the second filter.
If i now replace the "='Table'[Column B]" with a number that it should take (99,88,77...) it shows the correct result. But since its now a static number, it shows the same Result in every line, instead of calc it always new.
Can someone help?
Try this:
= CALCULATE(FIRSTNONBLANK('Table'[Column C], TRUE()),
FILTER(FILTER('Table','Table'[Column A]=1),'Table'[Column B] = earlier('Table'[Column B])))

Excel multiple search/match and sum (edit: answered with SUMIFS, COUNTIFS)

I am looking for help to solve this excel problem.
Essentially I want to create a formula for cells in column F which does a multiple search on 3 criteria (on cells in columns A,B,C) and want to access the corresponding column D values where all these (multiple) matches occur, and sum this in column F. I'd also like a count of the amount of matches found to calculate the value in column F; placed alongside in column G.
e.g.
IF col_A_value (anywhere in whole A column) = current_col_A_value +/- 1
AND col_B_value (anywhere in whole B column) = current_col_B_value +/- 1
AND col_C_value (anywhere in whole C column) = current_col_C_value - 1
THEN (output in column F) the sum of all values from row D where this criteria is met
(also, as a seperate but related cell formula, output in column G) the total Count of times this occurs.
Note: the values in columns A,B,C are all integars and the +/- above means to search for any values which are either +1, 0, or -1 different in value. (i.e. this includes the value itself).
e.g. If the value in cell A1 = 10, B1 = 45, C1 = 881, then the first search criteria would look for all other rows with values of 9, 10 or 11 in column A. Then based on these rows, the second search criteria would refine the search to only those rows which also include either a 44, 45 or 46 in column B, and the third search criteria would refine the search again to only include those rows where the column C value is 880.
Next, the values in the column D cells from all of these 'filtered' rows would be summed and the result placed in the column F cell. (The count of these results rows would be put in column G. (seperate formula required))
Since these are all unique entries (think of columns A,B,C creating unique vector coordinates in space), there should be a maximum of 9 entries found and summed. A +/-1: 3 variations, B +/-1: 3 variations and C -1 only: 1 variation. In total: 3x3x1 = 9 unique rows maximum (and potentially none as a minimum, as in the below example).
(If no match is found a value of 0 is good.)
Example with A,B,C,D and E as given values, and column F values calculated (together with the count shown in col G):
A B C D E F G
1 1 1 90 8 0 0
1 2 1 80 6 0 0
1 3 1 70 1 0 0
1 4 1 60 6 0 0
2 1 1 50 1 0 0
2 2 1 40 8 0 0
2 3 1 30 6 0 0
2 4 1 20 8 0 0
3 1 1 10 8 0 0
3 2 1 11 6 0 0
3 3 1 12 1 0 0
3 4 1 13 1 0 0
1 1 2 99 8 260 4
1 2 2 89 6 360 6
1 3 2 79 1 300 6
1 4 2 69 6 180 4
2 1 2 59 1 281 6
2 2 2 49 8 393 9
etc
To illustrate how column F values are calculated here is the working:
260 = 90+80+50+40
360 = 90+80+70+50+40+30
300 = 80+70+60+40+30+20
180 = 70+60+30+20
281 = 90+80+50+40+10+11
393 = 90+80+70+50+40+30+10+11+12
Thanks a lot for any help with this!
These formulas should do what you desire:
F1: =SUMIFS(D:D,A:A,"<="&A1+1,A:A,">="&A1-1,B:B,"<="&B1+1,B:B,">="&B1-1,C:C,C1-1)
G1: =COUNTIFS(A:A,"<="&A1+1,A:A,">="&A1-1,B:B,"<="&B1+1,B:B,">="&B1-1,C:C,C1-1)
The formulas can simply be copied down as you need them...
(Still I don't know what col E is for)

excel:compare 2 columns and copy data on other columns

need help.. i trying to compare 2 columns and copy data in other columns..
Columns:
A B C D
1 3 10
2 4 20
3 1 30
4 2 40
5 0 50
i want to compare column A to B to find its duplicate and copy data from column C if column A has a duplicate at column B...
Result must be:
A B C D
1 3 10 0
2 4 20 40
3 6 30 10
4 2 40 20
5 0 50 0
thanks in advance...
An answer as I understand the question (assuming the change in col B is just a typo):
Input
A B C D
1 3 10
2 4 20
3 6 30
4 2 40
5 0 50
Output
A B C D
1 3 10 0
2 4 20 40
3 6 30 10
4 2 40 20
5 0 50 0
Formula in D2 (filled down): =IF(COUNTIF(B$2:B$6, $A2)>0, VLOOKUP($A2,$B$2:$C$6, 2, FALSE), 0).
COUNTIF(B$2:B$6, $A2) returns the number of times the value in A2 appears in the array B2:B6. If this value is greater than 0 (meaning that A2 is in B2:B6), the IF() function looks looks up A2 in col B and returns the value in the 2nd row (col C); if A2 is not in B2:B6, the formula returns 0.

Resources