How to find a value in one column in another column and return cells in row where value was found - excel

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.

Related

Excel Determine Ascending Rank Based on Each Date

Here is the raw data:
Date Name Score
25/2/2021 A 10
25/2/2021 B 8
25/2/2021 C 8
25/2/2021 D 4
25/2/2021 E 1
24/2/2021 A 0
24/2/2021 B 20
24/2/2021 C 7
24/2/2021 D 10
24/2/2021 E 4
I would love to assign consecutive rank (preferably ascending order) to the students by each date, as follows:
Date Name Score Rank
25/2/2021 A 10 1
25/2/2021 B 8 2
25/2/2021 C 8 2
25/2/2021 D 4 3
25/2/2021 E 1 4
24/2/2021 A 0 5
24/2/2021 B 20 1
24/2/2021 C 7 3
24/2/2021 D 10 2
24/2/2021 E 6 4
I've tried customised rank function but it's hard to output this result, how could I do that? Thanks in advance!
You can try below formula with Excel365. It will also work on unsorted data.
=XMATCH(C2,SORT(FILTER($C$2:$C$11,$A$2:$A$11=A2),1,-1))
In D2 use:
=COUNTIFS(A$2:A$11,A2,C$2:C$11,">"&C2)+1
EDIT: Based on your comment, try:
Formula in D2:
=SUM(--(UNIQUE(FILTER(C$2:C$11,A$2:A$11=A2))>C2))+1

SUM based on list of categories

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)

Sum Column that matches a given criteria in Excel

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)))

VLOOKUP + MATCH and MAX value

Hi i am trying to do a VLOOKUP with match and i succesfully did.
My formula looks like this:
VLOOKUP(A5;D:I;MATCH(B5;$A$1:$K$9;0);FALSE)
I know that VLOOKUP selects the first match, however i need it to pick the highest value. So my formula at the moment gives me value "100"(E5), when i need it to select value "300"(E6).
A B C D E F G H I
1 Company Profession 1 2 3 4 5
2 A 2 A 534 531
3 B 2 B 123 412
4 C 1 C 213
5 D 1 D 100 112
6 D 1 D 300 231
7 D 1 D 200 752
8 E 3 E 123 55 431
9 F 4 F 112
Can you help me with this? I am absolutely lost.
Thanks
Try the following SUMPRODUCT() Formula:
=SUMPRODUCT(MAX(($E$2:$I$9)*(A5=$D$2:$D$9)*(B5=$E$1:$I$1)))
Or the following AGGREGATE() formula:
=AGGREGATE(14;6;($E$2:$I$9)/((A5=$D$2:$D$9)*(B5=$E$1:$I$1)),1)

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)

Resources