Looping within a cell?

RaviWildcat

Board Regular
Joined
Jun 18, 2010
Messages
124
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello everyone - I've got a cell with several words in it and I want to capitalize only the names:

So, if I have a list with 3 names

Greg
Peter
Bobby

and my value in cell A1 is

greg -play the guitar for peter and bobby

I can probably do something like

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"greg","Greg"),"peter","Peter"),"bobby","Bobby")

This will work if I have 3 names but could get cumbersome if I have hundreds of names to check.

Is there a way to specify how many times to loop in a cell?

(I could also do an index match table to store all the names, but I'd still need to first check for name 1, then name 2 then name 3 etc)

I can also write a macro to put every word into an index table and then compare that table against a match table etc. but I wonder if it's possible to solve using a formula?

Ravi
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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
Back
Top