View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bpeltzer
 
Posts: n/a
Default Breaking up a string into separate columns

Have you tried using Data Text To Columns, indicating that the data is
delimited by commas? If that's not viable, the trick will be to use the
third argument to the FIND function, indicating where to start searching for
a comma; you'll want to start looking one character AFTER the first comma is
found.

"Loz" wrote:

Hi!!

I'm trying to break up a string into sub sections. Eg 1 cat, 2 dogs, 66
chickens...
So far I have managed to get the first number out, but to get the dog count
and the chicken count, I am finding it much more difficult - I think I'm
trying to complicate it the way I'm achieving my results. Can anyone please
help me?

eg.

cats Dogs1 Dogs2 Chicken
1 cat, 3 dogs, 60 chickens 1 1 cat, 3 3 ?
2 cats, 22 dogs, 12 chickens 2 2 cats, 22 22 ?
3 cats, 2 dogs, 8 chickens 3 3 cats, 2 2 ?
4 cats, 21 dogs, 0 chickens 4 4 cats, 21 21 ?
5 cats, 256 dogs 5 5 cats, 256 256 ?

Cats formula: =LEFT(A3,FIND(" ca",A3)-1)
Dogs formula - Dogs1: =LEFT(A3,FIND(" do",A3)-1)
Dogs2: =RIGHT(C3,LEN(C3)-FIND(", ",C3)-1)
Chicken formula: ?

Is it possible to do one formula for each column? instead of breaking it up
like I have it?

TIA
Lauren
(sorry if my columns don't come out in columns...)