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.. |
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 |
All times are GMT +1. The time now is 01:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com