extract the landline/mobile numbers and Company names

snjpverma

Well-known Member
Joined
Oct 2, 2008
Messages
1,585
Office Version
  1. 365
Platform
  1. Windows
I have a data as shown in below sample. I want to extract the landline/mobile numbers and the company name. How do I do it?
Note: Possible Pattern that I can observe is 10 to 11 digit contiguous numbers (sometimes with spaces in between). Regards to the company names: they are always on the first lines. Generally there is a two to three line gap after each new company as shown below.

Numbers highlighted in Red and Company names in Green for clear explanation.

Below is the data :
===============================================

National Electric & Hardware

1.7

(14) • Electrical supply store

Mumbai, Maharashtra

10 • 022 2570 5283

In-store shopping


Bhavna Ford, Sec 1, Navi Mumbai

1.0

(1) • Ford dealer

Navi Mumbai, Maharashtra

6 • 070459 52118



Ace Electricals

No reviews • Electrical substation

Navi Mumbai, Maharashtra

Open now



Supreme Maintenance Services

No reviews • Company

Navi Mumbai, Maharashtra

6 • 022 2779 5357



Siemens CRP Factory

4.4

(5) • Electric utility manufacturer

Navi Mumbai, Maharashtra

Open now • 086521 95208



Shiv Electricals

4.3

(133) • Electrical equi ent supplier

Ulhasnagar, Maharashtra

10 • 0251 270 6295



Adarsh Electrical & Hardware Store

3.0

(1) • Electrical supply store

Mumbai, Maharashtra

9:30



General Electric

2.7

(3) • Corporate office

Navi Mumbai

022 2769 7238



Eureka Forbes Office

No reviews • Electronics store

Open 24 hours • 086928 68340



Maharashtra State Electricity Board

1.2

(38) • Electric utility company

Navi Mumbai, Maharashtra

022 2763 4052Maharashtra State Electricity Board

1.2

(38) • Electric utility company

Navi Mumbai, Maharashtra

022 2763 4052
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
The Company Names are always on the first line ... of what? How are you supposed to detect what constitutes the "first line"?
 
Upvote 0
The Company Names are always on the first line ... of what? How are you supposed to detect what constitutes the "first line"?

1st line after a 2 or more blank rows.
Below is the same data from Post # 1 when copied in an excel sheet.
Pattern: 1st line= company name, then company details with one blank row alternatively as shown below.
Please let me know if anymore clarifications required.

Data in Green is the company names and in Red Phone numbers.

1644758290710.png
 
Upvote 0
You can generate markers like this, then use whatever ordinary Excel methods you like to extract how you want:

Book1 (version 3).xlsb
ABC
1National Electric & HardwareCompany 
2  
31.7  
4  
5(14) • Electrical supply store  
6  
7Mumbai, Maharashtra  
8  
910 • 022 2570 5283 Phone
10  
11In-store shopping  
12  
13  
14Bhavna Ford, Sec 1, Navi MumbaiCompany 
15  
161  
17  
18(1) • Ford dealer  
19  
20Navi Mumbai, Maharashtra  
21  
226 • 070459 52118 Phone
Sheet4
Cell Formulas
RangeFormula
B1:B22B1=IF(ROW()=1,"Company",IF(ROW()>3,IF(AND(OFFSET(A1,-1,0,1,1)="",OFFSET(A1,-2,0,1,1)="",A1<>""),"Company",""),""))
C1:C22C1=IF(SUM(IFERROR(VALUE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))^0,0))>=8,"Phone","")
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
It does work on the sample as intended.

However, I just noticed that the data I copied earlier shows blanks as stated earlier. Maybe, because I copied it to Msword, Notepad, etc and was trying different method to work it on my own.

And now when I copied the data from the original source, it shows like shown below. Could you please made the change in the formula for Company name to work for this dataset?

Note: Only change is there aren't two blank rows but just one blank row before each company name. And no blank rows after every row in between as stated in my original post.

Really sorry for this misfortune.

1644771772592.png
 
Upvote 0
Hi,

See if this works for you.
Leave First Row Blank (e.g. A1 row)
Formula in B2 copied down, then filter blank rows:

Book3.xlsx
AB
1
2National Electric & HardwareNational Electric & Hardware
31.7 
4(14) • Electrical supply store 
5Mumbai, Maharashtra 
610 • 022 2570 528302225705283
7In-store shopping 
8 
9Bhavna Ford, Sec 1, Navi MumbaiBhavna Ford, Sec 1, Navi Mumbai
101 
11(1) • Ford dealer 
12Navi Mumbai, Maharashtra 
136 • 070459 5211807045952118
14 
15Ace ElectricalsAce Electricals
16No reviews • Electrical substation 
17Navi Mumbai, Maharashtra 
18Open now 
19 
20Supreme Maintenance ServicesSupreme Maintenance Services
21No reviews • Company 
22Navi Mumbai, Maharashtra 
236 • 022 2779 535702227795357
24 
25Siemens CRP FactorySiemens CRP Factory
264.4 
27(5) • Electric utility manufacturer 
28Navi Mumbai, Maharashtra 
29Open now • 086521 9520808652195208
30 
31Shiv ElectricalsShiv Electricals
324.3 
33(133) • Electrical equi ent supplier 
34Ulhasnagar, Maharashtra 
3510 • 0251 270 629502512706295
36 
37Adarsh Electrical & Hardware StoreAdarsh Electrical & Hardware Store
383 
39(1) • Electrical supply store 
40Mumbai, Maharashtra 
419:30 
42 
43General ElectricGeneral Electric
442.7 
45(3) • Corporate office 
46Navi Mumbai 
47022 2769 723802227697238
48 
49Eureka Forbes OfficeEureka Forbes Office
50No reviews • Electronics store 
51Open 24 hours • 086928 6834008692868340
52 
53Maharashtra State Electricity BoardMaharashtra State Electricity Board
541.2 
55(38) • Electric utility company 
56Navi Mumbai, Maharashtra 
57022 2763 4052Maharashtra State Electricity Board02227634052
581.2 
59(38) • Electric utility company 
60Navi Mumbai, Maharashtra 
61022 2763 405202227634052
Sheet990
Cell Formulas
RangeFormula
B2:B61B2=IF(A1="",A2,IFERROR(IF(IF(N(A2),"",MID(SUBSTITUTE(A2," ",""),IFERROR(FIND("•",SUBSTITUTE(A2," ",""))+1,1),11)+0),MID(SUBSTITUTE(A2," ",""),IFERROR(FIND("•",SUBSTITUTE(A2," ",""))+1,1),11),""),""))
 
Upvote 0
Solution
You'e welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,835
Messages
6,181,247
Members
453,026
Latest member
cknader

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