MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 25th, 2002, 07:06 AM   #1
AJ
Board Regular
 
Join Date: Mar 2002
Location: =ActiveCell.Address
Posts: 478
Default

Hi folks,

I've been looking through as I'm sure the answer to this question has already been covered on the board in many different guises but I can't find quite what I want.

Basically, say in Column A I have a list of cars/manufacturers that people have entered.
I've tidied up the entry a bit so that all entries are now of the format:

ManufacturerModelAdditionalInfo
i.e.
BMW 320
BMW 316 Compact
Honda Civic
Honda Civic 1.5L

What I then need in Columns B and C and D are the split out manufacturers in B, models in C, models + and other info in D.
I know I could do this with data|text to columns but I'd really like to know the formulae.
I've got Column B sorted as:
=IF(ISNUMBER(SEARCH(" ",A1)),LEFT(A1,SEARCH(" ",A1)-1),A1)
I had to add the IF bit as not everyone has entered the model (the cell could just say BMW with no spaces etc.)
I can't seem to get my head around the other two formula.
Formula for C should be something like:
Copy from cell after first space to next space or end of cell if no further spaces.
Formula for D should be something like:
Copy from cell after first space to end of cell.

Hope you can help.

Rgds

AJ is offline   Reply With Quote
Old Apr 25th, 2002, 07:52 AM   #2
Asala42
Board Regular
 
Join Date: Feb 2002
Location: Southfield,MI USA
Posts: 1,030
Default

G'day,

I think probably could just use the formula you already have in B1. For example in C1:

=LEFT(RIGHT(A1,LEN(A1)-LEN(B1)-1),SEARCH(" ",RIGHT(A1,LEN(A1)-LEN(B1)-1)))

And in D1:

=RIGHT(A1,LEN(A1)-LEN(B1)-LEN(C1)-2)

I suppose you might want to wrap an if statment around those to cover only partial entries.

Hope that helps somewhat,
Adam
Asala42 is offline   Reply With Quote
Old Apr 25th, 2002, 07:59 AM   #3
jrnyman
Board Regular
 
Join Date: Mar 2002
Location: Boston, MA
Posts: 105
Default

This should work for Col. C:

=IF(ISNUMBER(SEARCH(" ",A1,SEARCH(" ",A1)))=TRUE,MID(A1,LEN(B1)+2,SEARCH(" ",A1,LEN(B1)+2)-LEN(B1)),"")
jrnyman is offline   Reply With Quote
Old Apr 25th, 2002, 08:06 AM   #4
jrnyman
Board Regular
 
Join Date: Mar 2002
Location: Boston, MA
Posts: 105
Default

Sorry, it should be:

Col. A: =IF(ISNUMBER(SEARCH(" ",A1))=TRUE,LEFT(A1,SEARCH(" ",A1)-1),"")

Col. B: =IF(ISNUMBER(SEARCH(" ",A1,SEARCH(" ",A1)))=TRUE,MID(A1,LEN(B1)+2,SEARCH(" ",A1,LEN(B1)+2)-LEN(B1)-2),"")

Col. C: =IF(ISBLANK(C1)=FALSE,RIGHT(A1,LEN(A1)-SEARCH(" ",A1,LEN(B1)+LEN(C1)+1)),"")


HTH
jrnyman is offline   Reply With Quote
Old Apr 25th, 2002, 08:22 AM   #5
croweld89
New Member
 
Join Date: Mar 2002
Posts: 34
Default

Could you copy and paste column A in a seperate sheet, save that sheet as a text file, and then open the sheet with spaces delimited?

Being a board master I'm sure you've thought of that, so there must be a reason to have a formula in columns b-d.

Therefore, I have written down a formula from an earlier post as it caught my eye.
(The column C formula doesn't quite work, hopefully it will head you in the right direction.)

Column B
=left(a1,find(" ",A1)-1

Column C
=IF(ISERROR(FIND(" ",RIGHT(A10(FIND(" ",A10)-2)))),MID(A10,FIND(" ",A10)+1,FIND(" ",RIGHT(A10,FIND(" ",A10)))))

Column D
=right(A1,find(" ",A1)-1

Kudos to whoever originally posted this formula.
-Dave
croweld89 is offline   Reply With Quote
Old Apr 25th, 2002, 10:32 AM   #6
AJ
Board Regular
 
Join Date: Mar 2002
Location: =ActiveCell.Address
Posts: 478
Default


Thanks for all your help folks. I'm still not quite there though as I can't get the formula for Col C to work.
Just to say where I'm up to know.

Take the three possible type of entries in Column A:

BMW
BMW 320
BMW 325 TI

In Column B to strip our just the manufacturer I have:

=IF(ISNUMBER(SEARCH(" ",A2)),LEFT(A2,SEARCH(" ",A2)-1),A2)

In Column D to strip out everything but the manufacturer I have:
=IF(ISNUMBER(SEARCH(" ",A3)),RIGHT(A3,LEN(A3)-LEN(B3)-1),"")

I still can't get it to work for the middle column (C) though, where I only want the next entry after the manufacturer.

For the example the answers would be:
a blank cell for the just "BMW" entry
a cell showing "320" for the "BMW 320" entry
a cell showing "325" for the "BMW 325 TI" entry

Thanks again.

Rgds
AJ

BTW, this is not urgent, it's just something that intrigues me as to whether you can pick out the middle of a text string in this fashion. I know text to columns etc. etc. would work, I'm just trying to learn a bit more!
AJ is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:37 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes