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
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

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,039
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
47,926
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"
 

Watch MrExcel Video

Forum statistics

Threads
1,122,672
Messages
5,597,488
Members
414,146
Latest member
marginmakerb

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