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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

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,957
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,225
Messages
5,443,197
Members
405,219
Latest member
CraneS

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...
Top