Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to compare parts of text in different cells
HI,
can somebody help me with a problem: I want to write a code which can compare for example 4 letters in the middle in one cell with for instance 4 letters in the middle in an other cell, and then do something depending on if these 4 letters are the same or not.. for example, if I have these two different cells, and I want to see if the second cell has the same 4 digits in the middle.. E224_Gv080326f 3_3_01 E224_Gv080603f 3,2_3_01 I don't want to write a code like "recognize this exact combination of letters", since I have a lots of different cells and I want to compare them with eachoter. I want the next cell to be compared with ones before.. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to compare parts of text in different cells
On 20 Sty, 10:57, Ksenija wrote:
HI, can somebody help me with a problem: I want to write a code which can compare for example 4 letters in the middle in one cell with for instance 4 letters in the middle in an other cell, and then do something depending on if these 4 letters are the same or not.. for example, if I have these two different cells, and I want to see if the second cell has the same 4 digits in the middle.. * E224_Gv080326f 3_3_01 E224_Gv080603f 3,2_3_01 I don't want to write a code *like "recognize this exact combination of letters", since I have a lots of different cells and I want to compare them with eachoter. I want the next cell to be compared with ones before.. There is a function called MID(). It gives you back a partstring of a string. So what you could do, if you have e.g. these two strings: TR_5678 TR_5677 and want to know if the digits are the same. Mid("TR_5678",4,4) gives you back this 4 digits. Instead of the string you can of course set a reference, like A3. Now you can compare the strings in an IF() function to do something, when they match, for example. Regards, lolo |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find / Compare Text in 2 different cells | Excel Discussion (Misc queries) | |||
Compare parts of two sheets | Excel Worksheet Functions | |||
how do i compare 2 cells and extract the text that is different? | Excel Programming | |||
How do you compare text in cells | Excel Worksheet Functions |