Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find / Compare Text in 2 different cells nastech Excel Discussion (Misc queries) 2 October 30th 07 01:29 PM
Compare parts of two sheets Kalevi Excel Worksheet Functions 1 October 15th 05 06:55 AM
how do i compare 2 cells and extract the text that is different? ky1234 Excel Programming 1 October 6th 05 04:04 PM
How do you compare text in cells Sam Excel Worksheet Functions 1 February 18th 05 05:16 PM


All times are GMT +1. The time now is 07:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"