VLOOKUP + MATCH and MAX value - excel

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)

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

Using IF and AND function

I am trying to use the IF and AND function in excel for values in two different cells. I have 25 conditions.
Below is the formula I've created but it keeps on saying there's an error.
IF(AND(A10=“A”,B10=1),11,IF(AND(A=“A”,B10=2),16,IF(AND(A10=“A”,B10=3),20,IF(AND(A10=“A”,B10=4),23,IF(AND(A10=“A”,B10=5),25,IF(AND(A10=“B”,B10=1),7,IF(AND(A10=“B”,B10=2),12,IF(AND(A10=“B”,B10=3),17,IF(AND(A10=“B”,B10=4),21,IF(AND(A10=“B”,B10=5),24,IF(AND(A10=“C”,B10=1),4,IF(AND(A10=“C”,B10=2),8,IF(AND(A10=“C”,B10=3),13,IF(AND(A10=“C”,B10=4),18,IF(AND(A10=“C”,B10=5),22,IF(AND(A10=“D”,B10=1),2,IF(AND(A10=“D”,B10=2),5,IF(AND(A10=“D”,B10=3),9,IF(AND(A10=“D”,B10=4),14,IF(AND(A10=“D”,B10=5),19,IF(AND(A10=“E”,B10=1),1,IF(AND(A10=“E”,B10=2),3,IF(AND(A10=“E”,B10=3),6,IF(AND(A10=“E”,B10=4),10,15))))))))))))))))))))))))))))))))))))))))))))))))
I expected the output to be, for example; if cell1 is "A" and cell2 is 1 the result should be 11.
I would highly advise a lookup table. Simply have all of your options listed out with their desired results and find them with a criteria search, such as the use of sumifs function.
For example, if you paste J1:L25 your possibilities:
A 1 11
A 2 16
A 3 20
A 4 23
A 5 25
B 1 7
B 2 12
B 3 17
B 4 21
B 5 24
C 1 4
C 2 8
C 3 13
C 4 18
C 5 22
D 1 2
D 2 5
D 3 9
D 4 14
D 5 19
E 1 1
E 2 3
E 3 6
E 4 10
E 5 15
You can then place the formula =SUMIFS($L$1:$L$25,$J$1:$J$25,$A$10,$K$1:$K$25,$B$10) to return your desired value.
That is, =SUMIFS(range_of_results, criteria_range_of_A-E, A10, criteria_range_of_1-5, B10)

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

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.

Excel macro replace cell in A by other cell in B

I have a excel document where I have something like this
A B C
1 1 45 a
2 2 32 b
3 3 34 H
4 3 37
5 4 49 i
5 5 76 H
Note that 3c is combined but 3b isn't.
I need to do a macro to change the content of B with the content of C but only those that don't have a letter H. so the document would look like this
A B C
1 1 a a
2 2 b b
3 3 34 H
4 3 37
5 4 i i
5 5 76 H
Here a image
Just use this simple formula in column C,
=IF(B1="H",A1,B1)
and drag it throughout the range. Once done, copy paste all of the data in column C to A (paste special)

Transpose data in Excel

My table currently looks like this:
1 a b c d e
2 a
3 b d g h
4 a c
5 d e j
My desired format is this:
1 a
1 b
1 c
1 d
1 e
2 a
3 b
3 d
3 g
3 h
4 a
4 c
5 d
5 e
5 j
Is there a way to make this modification in Microsoft Excel? I have attempted this in Ms Access but there is a column limit (225) which I exceed. In addition, I have attempted to use the TRANSPOSE function in Excel, but this only switches rows to columns. Please provide suggestions on how this transformation might be achieved. Thanks!

Resources