Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default IF Then Statements for comparison

Hello, i want to make a function for comparing two excel file.

If A2(xls1) is found in ColumnB(xls2)
then check if B2(xls1) is equal to ColumnB(xls2) cell Result
If equal then input "ok" in E2(xls1)
if not equal the input "wrong" in E2(xls1)

Else "Not Found"



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default IF Then Statements for comparison

Sub Macro1()
Dim c As Range
Dim rng As Range
Dim bFound As Boolean
Dim iEnd As Long
Dim ws1 As Worksheet
Dim ws2 As Worksheet

Set ws1 = Sheets("Sheet1")
Set ws2 = Workbooks("Book2").Sheets("Sheet1")
iEnd = ws2.Range("B65536").End(xlUp).Row
Set rng = ws2.Range("B1:B" & iEnd)
For Each c In rng
If ws1.Range("A2") = c Then
If ws1.Range("B2") = c Then
ws1.Range("E2") = "ok"
Else
ws1.Range("E2") = "wrong"
End If
bFound = True
Exit For
End If
Next c
If bFound = False Then
ws1.Range("E2") = "Not Found"
End If

End Sub

Hth,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default IF Then Statements for comparison

Hello, Thanks for giving me idea, but sorry I think i have not made my
explanation more clear.


If A2(Worksheet1) is found in ColumnA(Worksheet2)
then check if B2(Worksheet1) is equal to ColumnB(Worksheet2) cell Result

"example of above: if it is found in B4(worksheet2), then compare it
with B2(worksheet1)"

If equal then input "ok" in E2(worksheet1)
if not equal the input "wrong" in E2(worksheet1)

Else "Not Found"



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default IF Then Statements for comparison

hi, also I include screenshot of what I want to accomplish.

Thank you for your help

http://glv.ne.jp/xls.JPG
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
Comparison TiffQ23 Excel Discussion (Misc queries) 1 February 18th 09 08:24 PM
Complex comparison of Columns of Data: Extracting unique records after comparison on 4 levels ap Excel Programming 2 January 23rd 07 10:12 AM
IF Statements (Mutliple Statements) Deezel Excel Worksheet Functions 3 October 19th 06 06:13 AM
operator statements, shorting when reusing one of the statements? KR Excel Programming 1 August 4th 05 06:20 PM
Comparison chartasap Excel Worksheet Functions 2 July 19th 05 02:09 PM


All times are GMT +1. The time now is 11:23 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"