complex IF functions

%3CLINGO-SUB%20id%3D%22lingo-sub-2858175%22%20slang%3D%22en-US%22%3Ecomplex%20IF%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2858175%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20looking%20to%20see%20what%20function%20would%20apply%20if%20I%20want%20to%20replicate%20some%20text%20from%20a%20column%20to%20another%20one%20but%20by%20modifying%20slightly%20its%20contents.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20a%20quick%20example%20I%20attached%20here%3A%20I%20want%20it%20so%20that%20when%20it%20says%20%22sunny%20INSIDE%22%20on%20one%20column%2C%20then%20it%20will%20say%20automatically%20%22sunny%20OUTSIDE%22%20on%20the%20other%20column%20at%20the%20same%20row.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%20can%20it%20be%20done%20with%20multiple%20possibilities%3F%20i.e.%20if%20I%20use%20%22rainy%20INSIDE%22%20then%20it%20goes%20%22rainy%20OUTSIDE%22%20etc.%20and%20if%20there%20is%20nothing%2C%20the%20cell%20stays%20blank.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20we%20do%20this%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThanks!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2858175%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2858280%22%20slang%3D%22en-US%22%3ERe%3A%20complex%20IF%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2858280%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1188998%22%20target%3D%22_blank%22%3E%40vmassera%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20say%20you%20have%20a%20text%20value%20in%20B2.%3C%2FP%3E%0A%3CP%3EEnter%20the%20following%20formula%20in%20C2%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DSUBSTITUTE(B2%2C%22INSIDE%22%2C%22OUTSIDE%22)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20can%20be%20filled%20down%20if%20required.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2858483%22%20slang%3D%22en-US%22%3ERe%3A%20complex%20IF%20functions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2858483%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20so%20much%20for%20this!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20can%20you%20do%20it%20automatically%20for%20the%20whole%20column%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20as%20soon%20as%20I%20enter%20a%20value%20(i.e.%20xyz%20%22INSIDE%22)%20on%20the%20first%20column%2C%20then%20it%20will%20match%20the%20same%20value%20on%20the%20same%20row%20in%20the%20other%20column%20(xyz%20%22OUTSIDE%22)%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi,

 

I'm looking to see what function would apply if I want to replicate some text from a column to another one but by modifying slightly its contents.

 

So a quick example I attached here: I want it so that when it says "sunny INSIDE" on one column, then it will say automatically "sunny OUTSIDE" on the other column at the same row.

 

Also can it be done with multiple possibilities? i.e. if I use "rainy INSIDE" then it goes "rainy OUTSIDE" etc. and if there is nothing, the cell stays blank.

 

How do we do this?

Thanks!!

6 Replies

@vmassera 

Let's say you have a text value in B2.

Enter the following formula in C2:

 

=SUBSTITUTE(B2,"INSIDE","OUTSIDE")

 

This can be filled down if required.

@Hans Vogelaar 

 

Thank you so much for this!

 

Now can you do it automatically for the whole column?

 

So as soon as I enter a value (i.e. xyz "INSIDE") on the first column, then it will match the same value on the same row in the other column (xyz "OUTSIDE") ?

@vmassera 

Simply fill or copy the formula down as far as you want/need.

What about if I want the same formatting (i.e. if the original text is red, make it red in the other cell too?)

@vmassera 

That requires VBA.

See the attached version.

The code is in the worksheet module. Right-click the sheet tab and select View Code to see it.

Wow thanks! Never delved into macros until now, but thank you for including this code. I'll have to start learning those!