Need help to understand formula

fayo2009

New Member
Joined
Apr 10, 2017
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Hello,

I was searching with Google for a way to extract the numbers from a text string (different numbers of characters) and found a formula that works perfectly. As glad as I am that it solved my problem, I can't figure out how it works. Could someone explain step by step what the formula is doing? I would really appreciate it.

in this example, my text string is in cell D2

Service Invoice line for 88837799 at 520348 Kromles Back Occupant KEL C VAT Recoverable

=LOOKUP(10^6,1*MID($D2,MIN(FIND({0,1,2,3,4,5,6,7,8,9},$D2&"0123456789",FIND(" at "," "&$D2&" "))),{2,3,4,5,6}))

Output- 520348
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
As you have 365 you can use this simpler formula.
Excel Formula:
=--TEXTBEFORE(TEXTAFTER(D2,"at ")," ")
 
Upvote 0
=--TEXTBEFORE(TEXTAFTER(D2,"at ")," "
Many thanks! The TEXTAFTER works.

Output:- 520348 Kromles Back Occupant KEL C VAT Recoverable

but the TEXTBEFORE doesn't seem to work I am getting #VALUE
 
Upvote 0
Maybe those are non-breaking spaces, try
Excel Formula:
=--TEXTBEFORE(TEXTAFTER(SUBSTITUTE(D2,CHAR(160)," "),"at ")," ")
 
Upvote 0
Solution
It worked with the below.

=TEXTBEFORE(TRIM(TEXTAFTER($D2,"at"))," ")
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0
Couldn't have done it without your help, much appreciated.

Thanks always for your prompt responses.
 
Upvote 0

Forum statistics

Threads
1,223,444
Messages
6,172,171
Members
452,445
Latest member
walkman99

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