By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,828 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,828 IT Pros & Developers. It's quick & easy.

code for splitting a cell (space being the deliminator)

P: n/a
Hi all, can anyone help. i have a spreasheet (set up by a looney)
they have in the surname field, the surname then forename. What sort
of code would i need to use to sort this out.

It looks like this:

|Smith Bill |14 Any Street|
|Doe John |19 High Stree|

and so on (there are 7891 of them). Would make life a lot easier to
run it in a module but cant for the life of me work out how to do it
(DUH!!!).

Thanks in advance.

Bill

bill underscore nirl at hotmail.com is my email :)
bi*******@hotmail.com or post it here :)

Aug 7 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 7 Aug 2006 13:04:46 -0700, bill_nirl wrote:
Hi all, can anyone help. i have a spreasheet (set up by a looney)
they have in the surname field, the surname then forename. What sort
of code would i need to use to sort this out.

It looks like this:

|Smith Bill |14 Any Street|
|Doe John |19 High Stree|

and so on (there are 7891 of them). Would make life a lot easier to
run it in a module but cant for the life of me work out how to do it
(DUH!!!).

Thanks in advance.

Bill

bill underscore nirl at hotmail.com is my email :)
bi*******@hotmail.com or post it here :)
A cell?
Spreadsheet?
Excel?
You have posted this message to the wrong newsgroup.
The access in this groups name refers to Microsoft Access, a database
program.
Please repost to the correct newsgroup for the Excel program you are
using. I would suggest you include your Windows and Office version
number in the message.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Aug 7 '06 #2

P: n/a
Thank you for your reply fred, no use at all, but thank you anyway.

I have imported the spreadsheet into access (access 97 as i prefer to
work with it, less wizards than the newer versions) so that i may do an
export as a csv file or indeed keep the data in access to enable
quicker and easier data manipulation (and link directly to word as a
mail merge file if required)

The bit of vb code that i was looking would take the space as being the
deliminated point and use to the left of it as the cell in the table.

I have the code for using the right hand side of the space to give me
the Forenames, but was hoping for the left hand side (which is not as
simple as i thought).

Once i have worked out the module, i will then run and update query to
populate a new table and remove or archive the old table.

I thought this was a simple question and if anyone would like the code
to work out the right side of the space as a new field, you are welcome
to it.........

fredg wrote:
On 7 Aug 2006 13:04:46 -0700, bill_nirl wrote:
Hi all, can anyone help. i have a spreasheet (set up by a looney)
they have in the surname field, the surname then forename. What sort
of code would i need to use to sort this out.

It looks like this:

|Smith Bill |14 Any Street|
|Doe John |19 High Stree|

and so on (there are 7891 of them). Would make life a lot easier to
run it in a module but cant for the life of me work out how to do it
(DUH!!!).

Thanks in advance.

Bill

bill underscore nirl at hotmail.com is my email :)
bi*******@hotmail.com or post it here :)

A cell?
Spreadsheet?
Excel?
You have posted this message to the wrong newsgroup.
The access in this groups name refers to Microsoft Access, a database
program.
Please repost to the correct newsgroup for the Excel program you are
using. I would suggest you include your Windows and Office version
number in the message.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Aug 7 '06 #3

P: n/a
On 7 Aug 2006 15:09:58 -0700, bill_nirl wrote:
Thank you for your reply fred, no use at all, but thank you anyway.

I have imported the spreadsheet into access (access 97 as i prefer to
work with it, less wizards than the newer versions) so that i may do an
export as a csv file or indeed keep the data in access to enable
quicker and easier data manipulation (and link directly to word as a
mail merge file if required)

The bit of vb code that i was looking would take the space as being the
deliminated point and use to the left of it as the cell in the table.

I have the code for using the right hand side of the space to give me
the Forenames, but was hoping for the left hand side (which is not as
simple as i thought).

Once i have worked out the module, i will then run and update query to
populate a new table and remove or archive the old table.

I thought this was a simple question and if anyone would like the code
to work out the right side of the space as a new field, you are welcome
to it.........

fredg wrote:
>On 7 Aug 2006 13:04:46 -0700, bill_nirl wrote:
>>Hi all, can anyone help. i have a spreasheet (set up by a looney)
they have in the surname field, the surname then forename. What sort
of code would i need to use to sort this out.

It looks like this:

|Smith Bill |14 Any Street|
|Doe John |19 High Stree|

and so on (there are 7891 of them). Would make life a lot easier to
run it in a module but cant for the life of me work out how to do it
(DUH!!!).

Thanks in advance.

Bill

bill underscore nirl at hotmail.com is my email :)
bi*******@hotmail.com or post it here :)

A cell?
Spreadsheet?
Excel?
You have posted this message to the wrong newsgroup.
The access in this groups name refers to Microsoft Access, a database
program.
Please repost to the correct newsgroup for the Excel program you are
using. I would suggest you include your Windows and Office version
number in the message.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
I would guess that the address (|14 Any Street|) is actually in a
different field.
If you are using Access, and ALL of the data is in the order of
LastName space FirstName, then:

LastName:Left([ullName],InStr([FullName]," ")-1)
FirstName:Mid([FullName],InStr([FullName]," ")+1)

Of course the above will fail if some of the names are like:
van der Meer Joseph
von Newman Carl
etc.

in which case you will need to alter your data and insert a comma
between last and first names.
Then you can use the above expressions, substituting "," for " " in
the above.

You could run a select query (which does not save the data)
or an Update query (which does), i.e:

Update YourTable Set YourTable.LastName =
Left([FullName],InStr([FullName]," ")-1), YourTable.FirstName =
Mid([FullName],InStr([FullName]," ")+1);

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Aug 7 '06 #4

P: n/a
On 7 Aug 2006 13:04:46 -0700, "bill_nirl" <bi*******@hotmail.com>
wrote:

Check out my earlier reply to a similar question:
http://groups.google.com/group/comp....0a8a9a5bfeed45

-Tom.

>Hi all, can anyone help. i have a spreasheet (set up by a looney)
they have in the surname field, the surname then forename. What sort
of code would i need to use to sort this out.

It looks like this:

|Smith Bill |14 Any Street|
|Doe John |19 High Stree|

and so on (there are 7891 of them). Would make life a lot easier to
run it in a module but cant for the life of me work out how to do it
(DUH!!!).

Thanks in advance.

Bill

bill underscore nirl at hotmail.com is my email :)
bi*******@hotmail.com or post it here :)
Aug 8 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.