Formula that would pick the last value in a column depending on the value in the next column

Dudi Shvejk

New Member
Joined
Aug 9, 2017
Messages
5
Hi everyone!
I need your help with the following issue.
I need a formula that would insert into a cell the last value from the first column depending on the wording in the second column. In other words, I need a formula that would insert into one cell the value of 40 (which is the last value with "football") and into another cell it should insert 456 (which is the last value for "tennis").
Thank you!
234tennis
4234football
546tennis
4tennis
456456football
40football
54645tennis
456tennis

<tbody>
</tbody>
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

wideboydixon

Well-known Member
Joined
Jun 2, 2016
Messages
3,401
Re: Help with the formula that would pick the last value in a column depending on the value in the next column

<b>Excel 2016 (Windows) 32 bit</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB"><colgroup><col width="25px" style="background-color: #DAE7F5" /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="text-align: right;;">234</td><td style=";">tennis</td><td style="text-align: right;;"></td><td style=";">tennis</td><td style="text-align: right;;">456</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style="text-align: right;;">4234</td><td style=";">football</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;">546</td><td style=";">tennis</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="text-align: right;;">4</td><td style=";">tennis</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style="text-align: right;;">456456</td><td style=";">football</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style="text-align: right;;">40</td><td style=";">football</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: right;;">56645</td><td style=";">tennis</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: right;;">456</td><td style=";">tennis</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">E1</th><td style="text-align:left">=LOOKUP(<font color="#0000FF">2,1/(<font color="#FF0000">$B$1:$B$8=$D$1</font>),$A$1:$A$8</font>)</td></tr></tbody></table></td></tr></table><br />

WBD
 
Last edited:

arthurbr

Well-known Member
Joined
Dec 8, 2006
Messages
1,960
Office Version
2010
Re: Help with the formula that would pick the last value in a column depending on the value in the next column

Perhaps something like = lookup(2,1/(b1:b10="football"),a1:a10)
Same for tennis
Adapt range as needed
 

Dudi Shvejk

New Member
Joined
Aug 9, 2017
Messages
5
Re: Help with the formula that would pick the last value in a column depending on the value in the next column

Thank you very much!
 

Dudi Shvejk

New Member
Joined
Aug 9, 2017
Messages
5
Re: Help with the formula that would pick the last value in a column depending on the value in the next column

Thank you!
 

Mike Szczesny

Active Member
Joined
Feb 7, 2008
Messages
411
Re: Help with the formula that would pick the last value in a column depending on the value in the next column

Can you something like this for the last text entry? =index($B$1:$B$8,match("Ω",$B$1:$B$8)) Use Alt+234 to produce Ω
 

Watch MrExcel Video

Forum statistics

Threads
1,095,627
Messages
5,445,571
Members
405,341
Latest member
AzureStoneDog

This Week's Hot Topics

Top