Formula for extracting text

jayjay123

New Member
Joined
Jun 3, 2021
Messages
45
Office Version
  1. 365
Platform
  1. Windows
Hi,

Example below, in a bank statement there are the below categories.
DISHONOUR Account Closed
DISHONOUR Refer to Cust
DISHONOUR Payment Stop
FEE Payment Stop Miscellaneous Debit
Fee Refer to Cust Miscellaenous Debit

Is there an excel formula that I can use to extract a phrase "Account Closed/Refer to Cust/Payment Stop"

Similar to this, but is there a formula...if it does not contain a specific text eg. Account Closed, then search up "Refer to Cust" or "Payment Stop"?

Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Maybe Try

=IF(ISNUMBER(SEARCH("Account Closed",A1)),"Account Closed",IF(ISNUMBER(SEARCH("Refer to Cust",A1)),"Refer to Cust",IF(ISNUMBER(SEARCH("Payment Stop",A1)),"Payment Stop","")))
 
Upvote 0
Solution
Could you use this?

21 08 19.xlsm
AB
1TextExtract
2DISHONOUR Account ClosedAccount Closed
3DISHONOUR Refer to CustRefer to Cust
4DISHONOUR Payment StopPayment Stop
5FEE Payment Stop Miscellaneous DebitPayment Stop
6Fee Refer to Cust Miscellaenous DebitRefer to Cust
Bank Statement
Cell Formulas
RangeFormula
B2:B6B2=LET(ary,{"Account Closed","Refer to Cust","Payment Stop"},CONCAT(IFERROR(MID(A2,SEARCH(ary,A2),LEN(ary)),"")))
 
Upvote 0
Maybe Try

=IF(ISNUMBER(SEARCH("Account Closed",A1)),"Account Closed",IF(ISNUMBER(SEARCH("Refer to Cust",A1)),"Refer to Cust",IF(ISNUMBER(SEARCH("Payment Stop",A1)),"Payment Stop","")))
this worked perfectly! thanks so much :)
 
Upvote 0
Hi, some fields return "FALSE". Can I replace these with "blank"? Would you know how to do this? thanks
Maybe Try

=IF(ISNUMBER(SEARCH("Account Closed",A1)),"Account Closed",IF(ISNUMBER(SEARCH("Refer to Cust",A1)),"Refer to Cust",IF(ISNUMBER(SEARCH("Payment Stop",A1)),"Payment Stop","")))
 
Upvote 0
Hi, some fields return "FALSE". Can I replace these with "blank"?
Did you try the other suggestion?
.. or this even shorter one?

21 08 19.xlsm
AB
1TextExtract
2DISHONOUR Account ClosedAccount Closed
3DISHONOUR Refer to CustRefer to Cust
4DISHONOUR Payment StopPayment Stop
5FEE Payment Stop Miscellaneous DebitPayment Stop
6Fee Refer to Cust Miscellaenous DebitRefer to Cust
7Other text 
Bank Statement
Cell Formulas
RangeFormula
B2:B7B2=LET(ary,{"Account Closed","Refer to Cust","Payment Stop"},FILTER(ary,ISNUMBER(SEARCH(ary,A2)),""))
 
Upvote 0
Could you use this?

21 08 19.xlsm
AB
1TextExtract
2DISHONOUR Account ClosedAccount Closed
3DISHONOUR Refer to CustRefer to Cust
4DISHONOUR Payment StopPayment Stop
5FEE Payment Stop Miscellaneous DebitPayment Stop
6Fee Refer to Cust Miscellaenous DebitRefer to Cust
Bank Statement
Cell Formulas
RangeFormula
B2:B6B2=LET(ary,{"Account Closed","Refer to Cust","Payment Stop"},CONCAT(IFERROR(MID(A2,SEARCH(ary,A2),LEN(ary)),"")))
Thanks so much for your response and taking the time to help me. I tried the formula but its returning #NAME?
 
Upvote 0
I tried the formula but its returning #NAME?
That most likely means that you do not yet have the LET function (some 365 subscribers have it but not all). In that case you could give this one a try as you should at least have the FILTER function.

21 08 19.xlsm
AB
1TextExtract
2DISHONOUR Account ClosedAccount Closed
3DISHONOUR Refer to CustRefer to Cust
4DISHONOUR Payment StopPayment Stop
5FEE Payment Stop Miscellaneous DebitPayment Stop
6Fee Refer to Cust Miscellaenous DebitRefer to Cust
7Other text 
Bank Statement
Cell Formulas
RangeFormula
B2:B7B2=FILTER({"Account Closed","Refer to Cust","Payment Stop"},ISNUMBER(SEARCH({"Account Closed","Refer to Cust","Payment Stop"},A2)),"")
 
Upvote 0
That most likely means that you do not yet have the LET function (some 365 subscribers have it but not all). In that case you could give this one a try as you should at least have the FILTER function.

21 08 19.xlsm
AB
1TextExtract
2DISHONOUR Account ClosedAccount Closed
3DISHONOUR Refer to CustRefer to Cust
4DISHONOUR Payment StopPayment Stop
5FEE Payment Stop Miscellaneous DebitPayment Stop
6Fee Refer to Cust Miscellaenous DebitRefer to Cust
7Other text 
Bank Statement
Cell Formulas
RangeFormula
B2:B7B2=FILTER({"Account Closed","Refer to Cust","Payment Stop"},ISNUMBER(SEARCH({"Account Closed","Refer to Cust","Payment Stop"},A2)),"")
Thanks for the alternative formula, really appreciate it! Not sure why its not working for me unfortunately.
This one (below) works. But I would also like to retrieve a "Blank" cell if its not part of those 3 categories. Would you know any way to amend the formula to incorporate that?

RasGhul said:
Maybe Try

=IF(ISNUMBER(SEARCH("Account Closed",A1)),"Account Closed",IF(ISNUMBER(SEARCH("Refer to Cust",A1)),"Refer to Cust",IF(ISNUMBER(SEARCH("Payment Stop",A1)),"Payment Stop","")))
 
Upvote 0
Thanks for the alternative formula, really appreciate it! Not sure why its not working for me unfortunately.
In what way does it not work now? Is it still #NAME?
If so that would indicate that you do not have Microsoft 365 like your profile says.

This one (below) works. But I would also like to retrieve a "Blank" cell if its not part of those 3 categories. Would you know any way to amend the formula to incorporate that?
This already returns blank if none of those three categories are found - see column B below.
If you want it to return the text "Blank", then include that in the final quote marks in the formula - see column C below.

21 08 19.xlsm
ABC
1TextExtract
2DISHONOUR Account ClosedAccount ClosedAccount Closed
3DISHONOUR Refer to CustRefer to CustRefer to Cust
4DISHONOUR Payment StopPayment StopPayment Stop
5FEE Payment Stop Miscellaneous DebitPayment StopPayment Stop
6Fee Refer to Cust Miscellaenous DebitRefer to CustRefer to Cust
7Other text Blank
8 Blank
Bank Statement
Cell Formulas
RangeFormula
B2:B8B2=IF(ISNUMBER(SEARCH("Account Closed",A2)),"Account Closed",IF(ISNUMBER(SEARCH("Refer to Cust",A2)),"Refer to Cust",IF(ISNUMBER(SEARCH("Payment Stop",A2)),"Payment Stop","")))
C2:C8C2=IF(ISNUMBER(SEARCH("Account Closed",A2)),"Account Closed",IF(ISNUMBER(SEARCH("Refer to Cust",A2)),"Refer to Cust",IF(ISNUMBER(SEARCH("Payment Stop",A2)),"Payment Stop","Blank")))
 
Upvote 0

Forum statistics

Threads
1,216,068
Messages
6,128,595
Members
449,460
Latest member
jgharbawi

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