First word in a cell

daffy

Board Regular
Joined
Mar 18, 2009
Messages
113
Hi Guys

Is this possible?

What i would like to do is.

If the first word in a cell for example says "travel" then display the content of another cell, if it does not then just leave the other cell blank.

Its a job sheet that says travel to ???????? or travel to ******
So i need to pick out just the word "travel"

There are other line in the spreadsheet that do not say travel at all so these to will be ignored.

This may be simple but i am stuck on it.

Thanks in advanced for any help.

Don
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Mike Blackman

Well-known Member
Joined
Jun 8, 2007
Messages
2,494
Hi,

Maybe something like this?

=IF(LEFT(A1,FIND(" ",A1)-1)="Travel",B1,"")
 

baitmaster

Well-known Member
Joined
Mar 12, 2009
Messages
2,042
in a new cell3, try: =if(left([cell1],6)="travel",[cell2],"")

where [text] are your relevant cell references
 

daffy

Board Regular
Joined
Mar 18, 2009
Messages
113
Guys

Thanks for the quick responce.

Mike, Got yours to work no problem

Bait Master Could not seem too get your to work.

Thank you both for your help (it was much needed)

Don
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
54,296
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Guys

Thanks for the quick responce.

Mike, Got yours to work no problem

Bait Master Could not seem too get your to work.

Thank you both for your help (it was much needed)

Don
Mike's solution included a check to make sure the first word was "Travel" rather than something like "Travelling". A simpler way to do that would be:
=IF(LEFT(A1,7)="Travel ",B1,"")
 

daffy

Board Regular
Joined
Mar 18, 2009
Messages
113
Peter

Thank you for your post.

Could you explain to me what the number 7 is for.

=IF(LEFT(A1,7)="Travel ",B1,"")

Thanks

Don
 

Weaver

Well-known Member
Joined
Sep 10, 2008
Messages
5,196
LEFT(A1,7) refers to the first 7 characters in the string contained in cell A1

The idea being that "travel" is 6 letters and if the string started with "travelling" you'd still get a match, whereas comparing the first 7 characters and including the space after "travel " ensures this doesn't happen. If you want it to, go back to left(A1,6)="travel"
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,881
Messages
5,834,226
Members
430,267
Latest member
Excel_User_4

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top