LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Comparing a list of Records

Forgot the quotation marks.


Dim lr As Long, c As Range, iCnt As Long, jCnt As Long
lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Set sRng = ActiveSheet.Range("A2:A" & lr) 'Change to actual
rCnt = sRng.Rows.Count
For Each c In sRng
If Left(Trim(c.Value),2) = "CR" Then
iCnt = iCnt + 1
ElseIf Left(Trim(c.Value, 2) = "DR" Then
jCnt = jCnt + 1
End if
Next
If rCnt = iCnt Then
myVar = "HQ"
ElseIf rCnt = jCnt Then
myVar = "OC"
Else
myVar = "N/A"
End If








"ttp" wrote:

I need assistance comparing a list of records. Within my file, there are
records with multiple records. I want to perform the following If
statements. But, I don't know how to arrange it in Excel or Access.

If all the items in a field (column) begin with CR,
then variable = "HQ"
If all the items in a field (column) begin with DR,
then variable = 'OC"
Else variable = "N/A"

 
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
Comparing List A to List B and add what's missing from List B Gilbert Excel Discussion (Misc queries) 2 July 20th 09 11:18 PM
Comparing List A to List B and add what's missing from List B Gilbert Excel Discussion (Misc queries) 1 July 20th 09 08:41 PM
Comparing 2 lists to display only records in 1 but not in both lis Craig Excel Discussion (Misc queries) 1 August 2nd 08 11:36 PM
Comparing records from 2 tables Wes Zalewski Excel Programming 1 February 12th 04 03:17 PM
comparing a value to a list mark kubicki Excel Programming 1 February 10th 04 08:29 PM


All times are GMT +1. The time now is 03:05 AM.

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

About Us

"It's about Microsoft Excel"