Consider the following Excel
A B C D
1 foo 7 whaa
2 bar 5 AA
3 baz 9 BB
4 bal 1 AA
5 oof 3 blah
6 aba 9 C
Extra:
Each row has either a value in column C OR in column D
The values in column Care categories (in this example ÀA,BB,C`)
The values in column Dcan be anything
I need a SUM (based on column A) as follows:
SUM of column B for all lines that have a value in (any value) in column D (called Rest)
SUM of column B for each category in column C. I have a list of the categories (see below)
So like this:
A B
1 Rest 10 <----- 7 + 3
2 AA 6 <----- 5 + 1
3 BB 9
4 C 9
What formulas do I need in column B above to get this result?
or, you can use sumproduct to solve:
H2=SUMPRODUCT(($D$4:$D$9=IF(G2="Rest","",G2))*$C$4:$C$9)
H2=SUMIF($D$4:$D$9,IF(G2="Rest","",G2),$C$4:$C$9)
Related
I have three columns, A, B and D
Column A and B have integer numbers that Im trying to map to column D which looks something like this:
A
B
C
D
1
3
7
2
4
9
I want to populate column C with column D's data, but I need to look like bellow:
A
B
C
D
1
3
7
7
2
4
7
9
3
3
7
4
4
7
5
3
7
1
4
9
2
3
9
3
4
9
4
3
9
5
4
9
I need to map column D and duplicate those numbers down to Column A and have Column C change every time Column A repeats to the first number, which in this case is 1
I have two tables with same column names, but different data.
Table1:
A B C D
1 3 4 5 OK
2 6 7 8
3 9 8 7
Table2:
A B C D
1 9 8 7
2 1 2 8
3 3 4 5
I want to write formula in D of Table2, which would copy D-column values by row values from Table1. (I want to find same row in other table and set D-column value for it).
I could use SUMIFS(Table1!$D:$D, Table1!$A:$A, "="&A1, Table1!$B:$B, "="&B1, Table1!$C:$C, "="&C1), but all the rows are unique and I have string value in $D:$D - I don't need SUM exactly, I need only one string value.
Is there any function to find column value by row condition?
The result I want:
A B C D
1 9 8 7
2 1 2 8
3 3 4 5 OK
I want to find a value in column E, then get values from same row from columns B, C, and D. So I want to find 1 in column E, and the values from B, C, and E, then find 2 in column E and values from B, C, and D and all the way through 18.
I have tried VLOOKUP, INDEX/MATCH
B C D E
1 4 365 3
2 5 464 2
3 3 151 15
4 4 417 1
5 4 284 7
F G H I
1 4 4 417
2 2 5 464
3 1 4 365
G2: =INDEX($B$2:$E$6,MATCH($F2,$E$2:$E$6,0),1)
H2: =INDEX($B$2:$E$6,MATCH($F2,$E$2:$E$6,0),2)
I2: =INDEX($B$2:$E$6,MATCH($F2,$E$2:$E$6,0),3)
and fill down as far as needed, adjusting the array address as required.
I have data shaped like the following in excel:
A B C D
"foo" 5 3 1
"foo" 2 4 5
"foo" 5 5 5
"bar" 1 2 3
"bar" 4 5 7
I want to know how many rows contain "foo" in column A and 5 in either one of column B, C or D.
In other words, I want the following formula =COUNTIFS(A1:A5;"foo";B1:B5;5;C1:C5;5;D1:D5;5), but with the B, C and D ranges or'ed together instead of and'ed. Is there a simple way to do this with an excel formula?
Try,
=SUMPRODUCT((A1:A5="foo")*SIGN((B1:B5=5)+(C1:C5=5)+(D1:D5=5)))
If we can use a extra column then also we can achieve this task
A B C D E
foo 5 0 1 =COUNTIF(B2:D2,5)(1)
foo 2 5 5 =COUNTIF(B3:D3,5)(2)
foo 5 5 5 =COUNTIF(B4:D4,5)(3)
bar 1 5 3 =COUNTIF(B5:D5,5)(1)
foo 4 0 7 =COUNTIF(B6:D6,5)(0)
Then, we can use countifs
=COUNTIFS(A:A,"foo",E:E,">0") = 3
How would I sum vertically the columns that meet a given criteria?
For example:
A B C D E F G
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
If criteria = A, then the formula would give me 4
if B, 8
if C, 12. I would like the criteria input to be a reference-able cell.
Thanks for your help!
Use INDEX to return the correct array. Use MATCH to return the correct column:
=SUM(INDEX(2:5,0,MATCH(J1,1:1,0)))
Assuming you have a sheet like this:
=SUM(INDEX($BF$5:$BI$16,,Match($BC$5,$BF$4:$BI$4,0)))