Extract Text using one formula

pto160

Active Member
Joined
Feb 1, 2009
Messages
473
Office Version
  1. 365
Platform
  1. Windows
I have the latest version of Excel 365 with all the new functions. :) so I am wondering if extracting text will be easier.
So if cell in column A says "Bank" then the result returned will be the text in column B.
There is two scenarios with the cell named GL in column A where the text string begins with an A. The max length of the text string allowed is 10 characters.
First scenario, is text beginning with a "A" then yymmdd then the last 3 characters reserved for a number. If the last three characters are a number like for example 005 or 010 or 400 then the result returned will be 5, 10 or 400 returned in column C.
The next scenario, If the last character or last two characters are a letter like B or AC, then the text is formatted beginning with an A then mmddyy then the number then the letter or two letters at the end. If the string ends with a two letters like "AC", then I can't use 02 for the month as it would exceed 10 characters. I have to use 2 for the month. The example will makes this clearer.

Book1
ABCD
1Result I want
2Bank55 Text Length
3GLA221228005510
4GLA2212280101010
5GLA22122840040010
6GLA12282201A110
7GLA12282202A210
8GLA1228222AC210
9GLA12282210A1010
Sheet1
Cell Formulas
RangeFormula
C2C2=IF(A2="Bank",B2)
D3:D9D3=LEN(B3)
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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