Changing upper case to lower case for 3 letters of a word

Milos

Board Regular
Joined
Aug 28, 2016
Messages
103
Hello all,

Would it be possible to alter a whole column (as shown in column B) so that any upper case
entries remain upper case for the first three letters of a word but all other letters change to lower case (as shown in column C). However this would only apply to particular cells within the column as specified by another column (as shown in column A).


ABC
1ChangeUppercaseLowercase
2YesRUMCOKERUMcoke
3YesVODKALEMONVODkalemon
4YesWHISKEYDRYWHIskeydry
5No
RUMCOKERUMCOKE
6NoVODKALEMONVODKALEMON
7NoWHISKEYDRYWHISKEYDRY

<tbody>
</tbody>


Thanks,
 

BQardi

Active Member
Joined
Aug 30, 2016
Messages
483
Something like this in C2 drag down:
Code:
=IF(A2="Yes",UPPER(LEFT(B2,3))&LOWER(RIGHT(B2,LEN(B2)-3)),B2)
 

Milos

Board Regular
Joined
Aug 28, 2016
Messages
103
Thanks BQardi that is perfect! I was struggling with Upper an lower case formatting with the IF function.

I am wanting to specify this code a little more if possible. Do know how would alter the code so that the logical test part of the IF function ("Yes" for the example above) just has to contain the values "yes" and this function will work.

For example if there were a multitude of cells down column A the cells all contained different values such as "Yes", "Yesterday", YesserieBob" "Yesabel" and it would still pick up the value "Yes" and change the cell according to the IF function. I am trying to implement the SEARCH function to no avail.
 

BQardi

Active Member
Joined
Aug 30, 2016
Messages
483
Yeah, should be something like this:
Replace:
Code:
=IF([COLOR=#ff0000]A2="Yes"[/COLOR],UPPER(LEFT(B2,3))&LOWER(RIGHT(B2,LEN(B2)-3)),B2)
with:
Code:
=IF([COLOR=#ff0000]IFERROR(SEARCH("yes",A2),0)>0[/COLOR],UPPER(LEFT(B2,3))&LOWER(RIGHT(B2,LEN(B2)-3)),B2)
 

Milos

Board Regular
Joined
Aug 28, 2016
Messages
103
Thanks again. Is there also a possibility for the function to outline more than one text option?

Lets say I added another word into column A so the options were Yes, No and affirmative. Could I rework the formula so that two groups of text to apply in this function ("yes" and "affirmative").
 

BQardi

Active Member
Joined
Aug 30, 2016
Messages
483
Yes you can use the OR function:
Code:
=IF([COLOR=#ff0000]OR[B]([/B][/COLOR]IFERROR(SEARCH("yes",A2),0)>0[COLOR=#ff0000],IFERROR(SEARCH("affirmative",A2),0)>0[/COLOR][COLOR=#ff0000][B])[/B][/COLOR],UPPER(LEFT(B2,3))&LOWER(RIGHT(B2,LEN(B2)-3)),B2)
 

Milos

Board Regular
Joined
Aug 28, 2016
Messages
103
Legend, thanks man.

I am always so close with my coding but just a little mistake throws the whole thing off!
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
8,994
Just to show that Excel usually has several ways of accomplishing something, here's another option:

=IF(SUM(COUNTIF(A2,{"*yes*","*affirmative*"})),UPPER(LEFT(B2,3))&LOWER(MID(B2,4,99)),B2)
 

jamcall

Active Member
Joined
Sep 19, 2013
Messages
287
Had to laugh seeing a question with example data involving Rum & Coke being answered by BQardi (Bacardi)... :LOL:

Cheers,
~ Jim
 

BQardi

Active Member
Joined
Aug 30, 2016
Messages
483
Had to laugh seeing a question with example data involving Rum & Coke being answered by BQardi (Bacardi)... :LOL:

Cheers,
~ Jim
Hahaha...
I'm so used to my username that I never even realized this.
That is soooo funny...:LOL:
 

Forum statistics

Threads
1,082,258
Messages
5,364,086
Members
400,779
Latest member
lumers

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top