Last wildcard match in a row and returning columnnumber

RogerMaur

New Member
Joined
Nov 15, 2017
Messages
4
Hello everyone,

I've spend weeks trying to find a solution on the internet for my spreadsheet. Usually I can find a solution or work something out, but this time I'm really stuck. It's also embarrissing to ask, because I have the feeling it's simple but I don't/can't see the solution.

Here is my problem:
I want to do a last wildcard match on a row.
For example The row contains code like B1, E2, B2, E1, N2, T1, T2, E3 etc. I want the last cell containing the letter 'B' and get that columnumber for using the Index function.

I am trying to use an arrray to accomplish this, but I can't get it to work.
Is there someone who can put me in the right direction?

I would be very thankfull!

Kind regards,
Roger
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Roger

try this code.

Code:
r = 1 'row number

c = Rows(1).Find(What:="b", After:=Cells(r, "A"), LookIn:=xlValues, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False _
        , SearchFormat:=False).Column
        
MsgBox c

hth,
Ross
 
Upvote 0
Rpaulson,

Thank you very much for your time and effort. But I'm trying to accomplish it with formulas instead of VBA. Sorry for my unclear post. But nonetheless, I will make a note of your code. It could be helpfull for future reference.

Kind Regards,
Roger
 
Upvote 0
Aladin Akyurek,

Thank you for your time and help. I'm trying to adapt your formula. But because I use Excel 2010 and in a different language I have to change it a little. I will give you feedback once I 'translated' it.

Kind regards,
Roger
 
Upvote 0
Aladin Akyurek,

Thank you very much. I adapted your formula and it works like a charm! I would never come up with this solution. I was searching in the direction of using an array. Althought I do not fully understand how the formula works, but I will delve into it. Thank you for your help.

Kind regards,
Roger
 
Upvote 0
Aladin Akyurek,

Thank you very much. I adapted your formula and it works like a charm! I would never come up with this solution. I was searching in the direction of using an array. Althought I do not fully understand how the formula works, but I will delve into it. Thank you for your help.

Kind regards,
Roger

You are welcome. Thanks for the update. Here is a small write-up on this type of formulas:
https://www.mrexcel.com/forum/excel-questions/724843-there-case-sensitive-vlookup.html
 
Upvote 0

Forum statistics

Threads
1,214,988
Messages
6,122,620
Members
449,092
Latest member
amyap

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