Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 12th, 2004, 02:37 PM
Registered User
 
Join Date: Feb 2004
Location: chicago, IL, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ever
Default Compare two Items of data(in column A and column B

Hello,

I have a problem. Big time! I am trying to do a comparison of two columns that contain email addresses. If the same email address appears in both column A and Column B. Then I want to Place a '1' or True in column C.

Any help I get on this will be greatly appreciated.

Ever

Music:(

Music
Reply With Quote
  #2 (permalink)  
Old February 12th, 2004, 03:08 PM
Authorized User
 
Join Date: Dec 2003
Location: Middletown, CT, USA.
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this
I assume row 1 is your header row so I'll move to row two.
Put this formula into C2
=Iif("A2"="B2","true","false")

This will return true if a2=b2, otherwise it will return false

Let me know if this helps

John

Reply With Quote
  #3 (permalink)  
Old February 12th, 2004, 03:31 PM
Authorized User
 
Join Date: Nov 2003
Location: Commerce Twp, MI, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You don't necessarily need to use vba to accomplish this. You can simply place a formula in the cells of column C as follows:

    
Code:
=A1=B1


If the value of cell B1 matches the value of A1 exactly, the value displayed in C1 will be True. Otherwise, C1 will display False.

If you still want the vba code to perform the comparison between two cells, check the Cells Property Example in the VBE help.


Good Luck,



Darrell L. Embrey
Reply With Quote
  #4 (permalink)  
Old February 13th, 2004, 12:44 PM
Registered User
 
Join Date: Feb 2004
Location: chicago, IL, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ever
Default

These are all really good suggestions. However, I don't know where Column A will be equal to Column B. The two like emails may not occur in the same row. They may occur (for example) in cell A2 and Cell B54. I've tried to sort the columns but that doesn't do it.

Thanks

Music
Reply With Quote
  #5 (permalink)  
Old February 13th, 2004, 12:54 PM
Authorized User
 
Join Date: Dec 2003
Location: Middletown, CT, USA.
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You will need to use vb and do a comparison loop... while not overly difficult this does require knowledge of vb...what is your ultimate goal...perhaps access is a better application to do this in

John

Reply With Quote
  #6 (permalink)  
Old February 13th, 2004, 12:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: London, , United Kingdom.
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you need to try some form of vlookup eg
Code:
=if(ISNA(VLOOKUP(yourCell, NameOfColARange, False)),0,1)
in col C. Set up a range to define the Column A data (or leave it as cell refs, up to you really). You need the false ion trhere, otherwise it comes up with 'close' matches, not exact.

HTH



There are two secrets to success in this world:
1. Never tell everything you know
Reply With Quote
  #7 (permalink)  
Old February 13th, 2004, 02:19 PM
Registered User
 
Join Date: Feb 2004
Location: chicago, IL, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ever
Default

You Guys,

I figured it out. Thank you so much.
Here is the solution.
And Here it is for anyone who cares.

=MAX(COUNTIF(A:A,B:B))

Elegant, yet effective.

Music
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
help merge same column data okboy SQL Server 2000 6 July 24th, 2007 01:36 AM
Disappearing Column Data dalezjc Classic ASP Databases 1 November 21st, 2006 09:42 AM
Multi column search and compare luxcs Excel VBA 1 November 16th, 2006 02:45 PM
previous column & next column ct Excel VBA 4 August 19th, 2005 04:50 AM
template column and bound column hidayah ASP.NET 1.x and 2.0 Application Design 1 April 9th, 2005 03:50 PM



All times are GMT -4. The time now is 10:00 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.