Search For Last Combination

JHusk

New Member
Joined
Dec 7, 2022
Messages
32
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
How would I find the last combination of a letter and number in a list?

A = Combinations
B = Results for A
C = Results for D

A1
A2
D1
A3
A4
D2
and so on...(not a pattern, just the result of previous selections).

So I would need Column B to return the last combination starting with "A", which would be A4. And Column B would return the last combination starting with "D", which would be D2.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try this

Book1
ABC
1A1AD
2A2A4D2
3D1
4A3
5A4
6D2
Sheet1
Cell Formulas
RangeFormula
B2:C2B2=LOOKUP(2,1/(LEFT($A$1:$A$6,1)=B1),$A$1:$A$6)
 
Upvote 0
Another option
Fluff.xlsm
ABC
1A1AD
2A2A4D2
3D1
4A3
5A4
6D2
7
8
Data
Cell Formulas
RangeFormula
B2:C2B2=XLOOKUP(B1&"*",$A$1:$A$10,$A$1:$A$10,"",2,-1)
 
Upvote 0
Try this

Book1
ABC
1A1AD
2A2A4D2
3D1
4A3
5A4
6D2
Sheet1
Cell Formulas
RangeFormula
B2:C2B2=LOOKUP(2,1/(LEFT($A$1:$A$6,1)=B1),$A$1:$A$6)
This works perfectly. Now what if I wanted to know what the next number in either sequence would be? Meaning, the returned results of the formula are A4 & D2 respectively, so the next numbers available in each sequence would be A5 & D3, respectively. How would I find those?
 
Upvote 0
How about
Fluff.xlsm
ABC
1A1AD
2A2A5D3
3D1
4A3
5A4
6D2
7
Data
Cell Formulas
RangeFormula
B2:C2B2=B1&SUBSTITUTE(XLOOKUP(B1&"*",$A$1:$A$10,$A$1:$A$10,"",2,-1),B1,"")+1
 
Upvote 0
Solution
Another option
Fluff.xlsm
ABC
1A1AD
2A2A4D2
3D1
4A3
5A4
6D2
7
8
Data
Cell Formulas
RangeFormula
B2:C2B2=XLOOKUP(B1&"*",$A$1:$A$10,$A$1:$A$10,"",2,-1)
This works great, exactly as I was asking for. Curious of your insight regarding the additional question of finding what would be next number in the given sequences.
 
Upvote 0
There was no insight, I just modified the formula I suggested in post#3 to match the new requirement in post#4.
 
Upvote 0
How about
Fluff.xlsm
ABC
1A1AD
2A2A5D3
3D1
4A3
5A4
6D2
7
Data
Cell Formulas
RangeFormula
B2:C2B2=B1&SUBSTITUTE(XLOOKUP(B1&"*",$A$1:$A$10,$A$1:$A$10,"",2,-1),B1,"")+1
This did the exact extra lookup I was hoping for. I wish I could have 24 hours with your brain lol

As always, thank you so very much for your help...
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,189
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top