|
![]() |
|
| Author |
|
|||||||
|
casa
Thimes
Posts: 2457
Location: Brisbane, Queensland
|
I have 1 column with a persons full name, and I want to split their first and last names into 2 separate columns. How2? |
|||||||
| #0 05:03pm 26/06/07 |
|
|||||||
|
system
|
--
|
|||||||
| #0 |
|
|||||||
|
trillion
Posts: 324
Location: Brisbane, Queensland
|
||||||||
| #1 05:21pm 26/06/07 |
|
|||||||
|
scooby
Posts: 3265
Location: Brisbane, Queensland
|
||||||||
| #2 06:15pm 26/06/07 |
|
|||||||
|
HERMITech
Posts: 5138
Location: Brisbane, Queensland
|
trillions link works if it's a delimited file. Easiest way of doing it is to make a copy of the whole range/column, then do a find & replace of *_ to get rid of everything before the space and then reverse that for the second column with _* to get rid of everything after the space. Oh, in case you don't get it.. the "_" is just an indicator for the space.
Milage may vary with names containing more than one space between them |
|||||||
| #3 09:01pm 26/06/07 |
|
|||||||
|
Obes
Posts: 5213
Location: Brisbane, Queensland
|
Need more details.
Text to columns is the answer, how much prepping you need to do on the data before doing it is the trick. Cos names Can be stored in many ways. Smith, John Smith, John J John J Smith SMITH John John SMITH John Smith |
|||||||
| #4 12:03am 27/06/07 |
|
|||||||
|
Jim
Posts: 5983
Location: Brisbane, Queensland
|
or just:
obes |
|||||||
| #5 12:06am 27/06/07 |
|
|||||||
|
stinky
Posts: 1957
Location: Brisbane, Queensland
|
||||||||
| #6 07:55am 27/06/07 |
|
|||||||
|
Obes
Posts: 5214
Location: Brisbane, Queensland
|
Excel is aimed at normal office people. Regex to normal office people is some nerd version of swahili.
And it is available as a add-in from MS I believe. |
|||||||
| #7 08:34am 27/06/07 |
|
|||||||
|
HeardY
Gaelic newb
Posts: 14753
Location: Ireland
|
so you admit you are a nerd then obes?
|
|||||||
| #8 08:39am 27/06/07 |
|
|||||||
|
Insom
Posts: 1605
Location: Brisbane, Queensland
|
even making your own functions in excel isn't as straightforward as it could be
it's time they forgot the office people and targeted the leet hax0rs |
|||||||
| #9 08:40am 27/06/07 |
|
|||||||
|
casa
Thimes
Posts: 2458
Location: Brisbane, Queensland
|
so has anyone answered my question yet? All I see is links to s*** that doesn't help me (although I could be wrong as I am dumb). Names are sorted like this: Simon Casagrande Sean O'Brien etc |
|||||||
| #10 08:45am 27/06/07 |
|
|||||||
|
Jim
Posts: 5984
Location: Brisbane, Queensland
|
steamyhawtmen.xls?
|
|||||||
| #11 08:49am 27/06/07 |
|
|||||||
|
TicMan
Posts: 2319
Location: Brisbane, Queensland
|
Export as CSV, open in notepad, find replace "space" with "," and open up in Excel again. Mind you it will quite plainly f*** up for all those people that have more than 2 words in their name but it's probably something you could fix manually.
|
|||||||
| #12 08:56am 27/06/07 |
|
|||||||
|
casa
Thimes
Posts: 2459
Location: Brisbane, Queensland
|
There we go, so easy, thanks heaps ticman |
|||||||
| #13 09:04am 27/06/07 |
|
|||||||
|
trillion
Posts: 326
Location: Brisbane, Queensland
|
casa when you go number twosey, does it hurt your brain as it scrapes past?
|
|||||||
| #14 10:07am 27/06/07 |
|
|||||||
|
HERMITech
Posts: 5139
Location: Brisbane, Queensland
|
find replace "space" What the f*** did I say???? Told you how to fix it n00b |
|||||||
| #15 10:15am 27/06/07 |
|
|||||||
|
TicMan
Posts: 2320
Location: Brisbane, Queensland
|
Ladies and Gentlemen, although I'm the proud winner of the Casa Excel Tricky Question trophy I would like to share it with Hermi.
|
|||||||
| #16 10:17am 27/06/07 |
|
|||||||
|
trillion
Posts: 327
Location: Brisbane, Queensland
|
This thread is just like Blades of Glory.
Hermi and Ticman will now perform their ice dance routine. |
|||||||
| #17 10:25am 27/06/07 |
|
|||||||
|
Obes
Posts: 5215
Location: Brisbane, Queensland
|
Ticman's solution is retarded. Casa you are an office bitch, learn to use Office bitch programs!
This is the in program version of Ticman's solution. Select the column after the names (menu) Insert -> Column (menu) Data -> Text to Column !Wizard! Select Delimited Next Untick Tab Tick Space (or whatever it is you have as a delimiter, can be multiple things) Next f*** with Formatting Finish. *IF* it says about to replace the contents with destination cells. Press Cancel. Then at least 1 of the names did no comply to the formatting you suggested. Which is when you need to write a formula. Now for the reliable (depending on how f***ed up your data is) formula way. nb. using <pre> which probably doesn't work. Using A9 as the example cell. To find out how words are in a cell
That will even pick up double spaces in between words because of the trim function. To return the Last Word in a cell.
To Return the First Word.
You could then use use substitute to remove extra formating, and functions like Proper to make em look consistent. eg.
eg. remove commas and proper case it. |
|||||||
| #18 10:51am 27/06/07 |
|
|||||||
|
casa
Thimes
Posts: 2461
Location: Brisbane, Queensland
|
This thread is full of gay, thanks everyone, your trophies are in the mail. |
|||||||
| #19 10:53am 27/06/07 |
|
|||||||
|
TicMan
Posts: 2321
Location: Brisbane, Queensland
|
I'll take my retarded solution I came up with in 30 seconds compared to the insane solution Obes proposes.
Trophy is still mine biotch! |
|||||||
| #20 10:57am 27/06/07 |
|
|||||||
|
Obes
Posts: 5216
Location: Brisbane, Queensland
|
For your solution to have been f***ed. All it needed was a name to have a , in it. Or for a Billy Bob Red-neck jnr to be in the mailing list. And you had no way to check if the data was f***ed.
Excel (and OOO Calc) have some really cool functionality in them and far too many people who use them daily, use it like its First Choice (pro 80s spec DOS works package). Turns out all he wanted was the first name.
Why do it using a formula ? Cos if you have to do it regularly, or via data pulled out via a query. It can all be automated, and made into a button so MrManager type can do it with out bothering you. You can also build in idiot proofing and error checking. ps. A Filemaker database that was designed in Filemaker II on an Apple, pre any relational versions, and then have had 10 people over at least 15years all with limited computer experience all randomly enter data in different ways. Has taught me a lot about how to get excel to tidy crap data up. Crazy s*** like phone number: 3865 ???? ... wtf ? why bother entering it and dates : 1-2, Jan-2, 2-Jan, 1/2/97 (and this data covers 1891-2007 so was that 1897 or 1997 ?) entered on machines set in both US and Aus formats ... I think it would have to be the worst set of data I have ever seen. No constraints, No type checking, no format enforcement, There are even records with no name for the person .... So angor ... |
|||||||
| #21 11:35am 27/06/07 |
|
|||||||
|
Opec
Posts: 4614
Location: Brisbane, Queensland
|
Just do it manually you lazy f***
|
|||||||
| #22 11:43am 27/06/07 |
|
|||||||
|
Obes
Posts: 5217
Location: Brisbane, Queensland
|
16000 rows, by 110 columns in 1 huge flat file exported out of Filemaker...
Which I have to mangle into a relational DB that's on Informix. sif. manual btw. the users are still editing stuff in Filemaker, so I have to write a series of scripts that mangle the data. I did it once, they kept using Filemaker instead. Work asked me to do it again, to which I replied its been done get them to pay for a pro to do it... 16 grand latter they made sure it failed by continuing to enter data while it was happening, and given us "old data" and then saying they didn't need stuff imported that they did. Now they have been told do it ! ... and they have come back to me again ... So this time I'll write scripts so I can rerun the process as many times as needed. |
|||||||
| #23 12:26pm 27/06/07 |
|
|||||||
|
HERMITech
Posts: 5141
Location: Brisbane, Queensland
|
force data validation on the cells = win
|
|||||||
| #24 10:32pm 27/06/07 |
|
|||||||
|
3dee
Posts: 1394
Location: Brisbane, Queensland
|
Anyone know how to change the colour of a cell in an IF statement??
=IF(logic, [colour=red]&"OMG BAD", [colour=blue]&"ITS ALL GOOD") sorta thing. |
|||||||
| #25 06:48am 28/06/07 |
|
|||||||
|
HeardY
Gaelic newb
Posts: 14755
Location: Ireland
|
just use conditional formatting?
|
|||||||
| #26 06:57am 28/06/07 |
|
|||||||
|
Spook
Posts: 18931
Location: Brisbane, Queensland
|
save to text file, bust out perl, profit
|
|||||||
| #27 08:03am 28/06/07 |
|
|||||||
|
Obes
Posts: 5220
Location: Brisbane, Queensland
|
I'd say conditional formatting also.
Which makes heardy not a noob ... this thread sucks now |
|||||||
| #28 08:12am 28/06/07 |
|
|||||||
|
HeardY
Gaelic newb
Posts: 14756
Location: Ireland
|
haha that means I know 'something'
jesus, who'd have thought ;) I am no excel guru by any means, but I have to use it for a f***load of things at work and have picked up a thing or two over the years <3 obes |
|||||||
| #29 08:20am 28/06/07 |
|
|||||||
|
Mantra
Crusty old man
Posts: 1736
Location: Brisbane, Queensland
|
save to text file, bust out perl, profitWelcome to the 90s! =D |
|||||||
| #30 06:52pm 28/06/07 |
|
|||||||
|
Spook
Posts: 18935
Location: Brisbane, Queensland
|
im still living in the 90's man
|
|||||||
| #31 07:00pm 28/06/07 |
|
|||||||
|
Jim
Posts: 5999
Location: Brisbane, Queensland
|
can perl do mail loops?
|
|||||||
| #32 07:14pm 28/06/07 |
|
|||||||
|
Opec
Posts: 4620
Location: Brisbane, Queensland
|
perl sux
|
|||||||
| #33 08:37pm 28/06/07 |
|
|||||||
|
Spook
Posts: 18943
Location: Brisbane, Queensland
|
sif perl sux
#!/usr/bin/perl -w # camel code last edited by Spook at 09:03:09 29/Jun/07 |
|||||||
| #34 09:03am 29/06/07 |
|
|||||||
|
Jim
Posts: 6004
Location: Brisbane, Queensland
|
opec catches a spook
|
|||||||
| #35 07:53am 29/06/07 |
|
|||||||
|
system
|
--
|
|||||||
| #35 |
|
|||||||
|
| ||||||||