Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
bxc2739
 
Posts: n/a
Default Can excel macro access SUBstring individual 'char' level? If so how?


If possible I'd like to compare only the first character of each of the
customer name fields.
Sometimes the customers go by acrynoms and sometimes the name is fully
spelled out. So
to avoid a false negative it is more safe to search/filter by the first
character of the beginning of the
word/name only. Does excel macro allow substring functionality? If I am
to comparing the first char of the name
field of each sheet how to I access this, what is the syntax for
accessing & comparing substring characters??

This shouldn't be too difficult (to use a marco to compare two fields
at a time for matching) but I don't know
how to write the code.

I have two sheets 1 & 2. I’m to match customers from sheet 2 to 1.

I want to match by zip code and by name. If zip AND name of row(x) in
sheet 2
Matches with zip AND name of ANY of the 5000+ row(s) in sheet 1 then
highlight row(x) in sheet2. (to indicate a match)
If no match are found, then do nothing, and move on to next row of
sheet2 until all rows of sheet2 are finished comparing to the sheet1.

Basically I need to compare TWO fields simultaneiously, (double match)
per row to the respective TWO fields with the second sheet I am
comparing too. If both criteria are meet then it is a match. Otherwise
it is left alone/ignored. I want to do this for all 35000+ rows in my
sheet2 which will take a long time without the help of a macro. Both
the sheet to be worked on (sheet 2) and the sheet that exists only for
comparison (sheet1) are huge and have many entries.

What I need to do now is the second step: How do I compare AT THE SAME
TIME both the ZIP CODE (numeric) AND the CUSTOMER NAME
(string/character/word) of sheet2 to the Zip and Name of sheet1.??

Do I need a nested FOR LOOP or a seperate for Loop after the first
one??
How shall I go about coding this? I've tried a lot of things but it
never works..


--
bxc2739
------------------------------------------------------------------------
bxc2739's Profile: http://www.excelforum.com/member.php...o&userid=32538
View this thread: http://www.excelforum.com/showthread...hreadid=535928

  #2   Report Post  
Posted to microsoft.public.excel.misc
roadkill
 
Posts: n/a
Default Can excel macro access SUBstring individual 'char' level? If so ho

If you don't mind adding a few columns, you should be able to do this without
macros.

Add 2 columns to the big (35,000) row sheet. Let's say columns A and B.
- in the first, put "=left(C1,1) & D1" where C1 refers to the name column
(the 1 in the left function refers to the number of characters from the name
that will be used) in this same row and D1 refers to the zip code
- in the second put in consecutive number (1, 2, 3, ... so that each row is
identified by a number). This will let you tell what row matched up.

Add one column to the other sheet and put in a vlookup function to find the
match. It should look something like:

"=vlookup(left(J1,1) & K1,Sheet2!$A$1:$B$35000,2,0)" where columns J and K
have the name and the zip code on this sheet

The result will be either a number corresponding to the row that matches or
else "#N/A" to indicate not found.

Will

"bxc2739" wrote:


If possible I'd like to compare only the first character of each of the
customer name fields.
Sometimes the customers go by acrynoms and sometimes the name is fully
spelled out. So
to avoid a false negative it is more safe to search/filter by the first
character of the beginning of the
word/name only. Does excel macro allow substring functionality? If I am
to comparing the first char of the name
field of each sheet how to I access this, what is the syntax for
accessing & comparing substring characters??

This shouldn't be too difficult (to use a marco to compare two fields
at a time for matching) but I don't know
how to write the code.

I have two sheets 1 & 2. Im to match customers from sheet 2 to 1.

I want to match by zip code and by name. If zip AND name of row(x) in
sheet 2
Matches with zip AND name of ANY of the 5000+ row(s) in sheet 1 then
highlight row(x) in sheet2. (to indicate a match)
If no match are found, then do nothing, and move on to next row of
sheet2 until all rows of sheet2 are finished comparing to the sheet1.

Basically I need to compare TWO fields simultaneiously, (double match)
per row to the respective TWO fields with the second sheet I am
comparing too. If both criteria are meet then it is a match. Otherwise
it is left alone/ignored. I want to do this for all 35000+ rows in my
sheet2 which will take a long time without the help of a macro. Both
the sheet to be worked on (sheet 2) and the sheet that exists only for
comparison (sheet1) are huge and have many entries.

What I need to do now is the second step: How do I compare AT THE SAME
TIME both the ZIP CODE (numeric) AND the CUSTOMER NAME
(string/character/word) of sheet2 to the Zip and Name of sheet1.??

Do I need a nested FOR LOOP or a seperate for Loop after the first
one??
How shall I go about coding this? I've tried a lot of things but it
never works..


--
bxc2739
------------------------------------------------------------------------
bxc2739's Profile: http://www.excelforum.com/member.php...o&userid=32538
View this thread: http://www.excelforum.com/showthread...hreadid=535928


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
Excel Access and Oracle Chris K Excel Discussion (Misc queries) 1 February 17th 06 06:16 PM
Macro security level in excel will not change Randy Excel Discussion (Misc queries) 0 January 12th 06 11:06 PM
Macro security level in excel will not change to medium or low Randy Setting up and Configuration of Excel 0 January 12th 06 10:59 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Changing the format of an Excel output file made by Microsoft Access Amir Excel Discussion (Misc queries) 2 May 1st 05 12:57 AM


All times are GMT +1. The time now is 08:11 AM.

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"