#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Query in excel

Hi,

9,Bhagyoday Estate, Ajod Dairy Road, Rakhial Industrial Area, Ahmedabad -
380023 Gujarat
181, Industrial area - A, Ludhiana - 141003 Punjab
Opposite Rotomac Pens, Sarkhej Bavla Highway, Village Moraiya, Ta-Sanand,
Sanand - 382213 Gujarat
41/B, Lalbaug Industrial Estate, Dr.Ambedkar Road, Lalbaug, Mumbai - 400012
Maharastra


I want to split this into Address, city, pincode & State.

Can you help me?

Regards,
Ashwini
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Query in excel

If these texts are placed in separate cells, e.g. like this:


A1: 9,Bhagyoday Estate, Ajod Dairy Road, Rakhial Industrial Area, Ahmedabad
-
380023 Gujarat


A2: 181, Industrial area - A, Ludhiana - 141003 Punjab


A3: Opposite Rotomac Pens, Sarkhej Bavla Highway, Village Moraiya, Ta-Sanand,
Sanand - 382213 Gujarat


A4: 41/B, Lalbaug Industrial Estate, Dr.Ambedkar Road, Lalbaug, Mumbai -
400012
Maharastra

then install this UDF:

Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
Long
FindRev = 0
On Error Resume Next
FindRev = InStrRev(StrtoSearch, StrSearchedFor)
End Function

Formula

for address: =TRIM(LEFT(A1,FindRev(A1,",")-1))
for city:
=TRIM(MID(A1,FindRev(A1,",")+1,SEARCH("-",A1)-FindRev(A1,",")-1))
for code: =TRIM(MID(A1,SEARCH("-",A1)+2,6))
for state: =TRIM(MID(A1,SEARCH("-",A1)+8,256))


Regards,
Stefi

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Query in excel

Or - without UDF:

Formula

for address:
=TRIM(LEFT(A1,FIND("*",SUBSTITUTE(A1,",","*",LEN(A 1)-LEN(SUBSTITUTE(A1,",",""))))-1))

for city:
=TRIM(MID(A1,FIND("*",SUBSTITUTE(A1,",","*",LEN(A1 )-LEN(SUBSTITUTE(A1,",",""))))+1,SEARCH("-",A1)-FIND("*",SUBSTITUTE(A1,",","*",LEN(A1)-LEN(SUBSTITUTE(A1,",",""))))-1))

Regards,
Stefi


€žStefi€ ezt ร*rta:

If these texts are placed in separate cells, e.g. like this:


A1: 9,Bhagyoday Estate, Ajod Dairy Road, Rakhial Industrial Area, Ahmedabad
-
380023 Gujarat


A2: 181, Industrial area - A, Ludhiana - 141003 Punjab


A3: Opposite Rotomac Pens, Sarkhej Bavla Highway, Village Moraiya, Ta-Sanand,
Sanand - 382213 Gujarat


A4: 41/B, Lalbaug Industrial Estate, Dr.Ambedkar Road, Lalbaug, Mumbai -
400012
Maharastra

then install this UDF:

Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
Long
FindRev = 0
On Error Resume Next
FindRev = InStrRev(StrtoSearch, StrSearchedFor)
End Function

Formula

for address: =TRIM(LEFT(A1,FindRev(A1,",")-1))
for city:
=TRIM(MID(A1,FindRev(A1,",")+1,SEARCH("-",A1)-FindRev(A1,",")-1))
for code: =TRIM(MID(A1,SEARCH("-",A1)+2,6))
for state: =TRIM(MID(A1,SEARCH("-",A1)+8,256))


Regards,
Stefi

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 / MS Query - editing existing query to another sheet Hotpepperz Excel Discussion (Misc queries) 0 June 13th 08 06:53 PM
Query from microsoft query- Excel 2007 ื˜ื‘ืœืื•ืช ืืงืกืœ 2007 Excel Discussion (Misc queries) 0 December 24th 07 10:47 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 1 November 29th 05 01:44 PM
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? jocke Excel Discussion (Misc queries) 0 November 28th 05 06:37 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


All times are GMT +1. The time now is 11:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ฉ2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"