Required Excel Formula or VBA code to extract Numbers from String after special character "/" with 3 condition

Harmandeep

New Member
Joined
Dec 19, 2022
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hi Excel Experts,

I am trying to extract Numbers from String after special character "/" with Formula 'MID(A2, SEARCH("/",A2) + 1, SEARCH("/",A2,SEARCH("/",A2)+1) - SEARCH("/",A2) - 1)'. I have 3 diff types of String it works fine in 1 condition but failed to extract in rest 2 condition. I am attaching sample data table below & image for your reference.

ParticularsResult with FormulaExpected Result
IFT/CB0023519258/2000189024/MAHANADI COALFIELDS LCB0023519258CB0023519258
IMPS/P2A/235314533268/DIGITALI/IDFCBank/IMPSTXNP2A235314533268
NEFT/000001993682/2780032276/LAVYA MARKETING000001993682000001993682
RTGS/CBINR52022122810002779/18NEWDISTR/VINAYAK ENCBINR52022122810002779CBINR52022122810002779
TRANSFER/IC/25-980520196-1/ARPIT ENTERPRISE/WatchIC25-980520196-1
UPI/P2A/235423827250/KRISHAN K/Bank of B/UPIP2A235423827250
IMPS/234004143173
#VALUE!
234004143173
 

Attachments

  • String.PNG
    String.PNG
    19.4 KB · Views: 15

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
How about
Fluff.xlsm
AB
1Particulars
2IFT/CB0023519258/2000189024/MAHANADI COALFIELDS LCB0023519258
3IMPS/P2A/235314533268/DIGITALI/IDFCBank/IMPSTXN235314533268
4NEFT/000001993682/2780032276/LAVYA MARKETING000001993682
5RTGS/CBINR52022122810002779/18NEWDISTR/VINAYAK ENCBINR52022122810002779
6TRANSFER/IC/25-980520196-1/ARPIT ENTERPRISE/Watch25-980520196-1
7UPI/P2A/235423827250/KRISHAN K/Bank of B/UPI235423827250
8IMPS/234004143173234004143173
Data
Cell Formulas
RangeFormula
B2:B8B2=LET(a,DROP(TEXTSPLIT(A2,"/"),,1),TAKE(FILTER(a,LEN(a)>3),,1))
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Why are PA2 and IC not correct? What makes the Expected Values correct for those instances? Will there be more similar oddities? Is it the length of the result, i.e. the result needs to be more than 3 characters?
Never mind. Nice solution @Fluff
 
Upvote 0
From what I can see there is no "Rule of Thumb" or consistant for a formula to work on. A possible solution would be to use TEXT TO COLUMNS or TEXTSPLIT,but you will have the same issue with unwanted columns
 
Upvote 0
Hi Fluff,

There is one more condition i need to fulfill with same formula as provided by you. When there is no special character. Sample table given below

Transaction ParticularsFormulaExpected Result
236518255796
#CALC!
236518255796
IFT/CB0023519258/2000189024/MAHANADI COALFIELDS LCB0023519258CB0023519258
IMPS/234004143173234004143173234004143173
IMPS/P2A/235314533268/DIGITALI/IDFCBank/IMPSTXN235314533268235314533268
NEFT/000001993682/2780032276/LAVYA MARKETING000001993682000001993682
RTGS/CBINR52022122810002779/18NEWDISTR/VINAYAK ENCBINR52022122810002779CBINR52022122810002779
TRANSFER/IC/25-980520196-1/ARPIT ENTERPRISE/Watch25-980520196-125-980520196-1
UPI/P2A/235423827250/KRISHAN K/Bank of B/UPI235423827250235423827250

Regards,
Harmandeep Singh
 
Upvote 0
How about
Excel Formula:
=LET(a,TEXTSPLIT(A2,"/"),IF(COLUMNS(a)=1,a,TAKE(FILTER(DROP(a,,1),LEN(DROP(a,,1))>3),,1)))
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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