+ Reply to Thread
Results 1 to 12 of 12

Using an IF statement to produce an error if data doesn't match in columns

  1. #1
    Registered User
    Join Date
    02-10-2016
    Location
    Wayne, NJ
    MS-Off Ver
    2016
    Posts
    21

    Using an IF statement to produce an error if data doesn't match in columns

    Hello,

    I have 3 columns

    Column A - first name
    Column B- last name
    Column C - Contains both the first and last name (Although this was pasted from another source).

    I need to make sure the first and last names in Column C are an exact match to the first and last names from column A and B.

    I am trying to get an If statement in Column D to produce an error if they are not a match?

    Is this possible??

    Thank you!
    Babs

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Using an IF statement to produce an error if data doesn't match in columns

    Try

    =EXACT(A1 & " " & B1,C1)

    pasted into D1 and copied down
    Martin

  3. #3
    Registered User
    Join Date
    02-10-2016
    Location
    Wayne, NJ
    MS-Off Ver
    2016
    Posts
    21

    Re: Using an IF statement to produce an error if data doesn't match in columns

    Hello,

    Well, I did try this and some are coming up false, that should not be?
    I don't see any extra spaces? and I tried to make a few myself with simple copy in both columns and then putting that name in the 3rd one manually and it comes up false?

    Do you know why they would be false?

    Thank you!!!!
    Babs

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: Using an IF statement to produce an error if data doesn't match in columns

    1. Is the capitalization the same for A&" " & B versus C?
    2. Try, in blank cells (assuming row 5 is false), =LEN(A5&" " & B5) and =LEN(C5) They should give the same number.
    3. Try =EXACT(TRIM(A5& " " & B5), TRIM(C5))
    Any of that give us some hints?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Using an IF statement to produce an error if data doesn't match in columns

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  6. #6
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Using an IF statement to produce an error if data doesn't match in columns

    @ sophie,
    Please do not duplicate the thread as this is against the forum rules, I have marked other thread as closed, as two seniors have already responded here
    Last edited by hemesh; 02-10-2016 at 02:28 PM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,002

    Re: Using an IF statement to produce an error if data doesn't match in columns

    Possible problems

    There are extra blanks at end of first and/or second names

    There is more than one blank between first and last names in C

    Typos in any entry

    Try

    =EXACT(TRIM(A1) & " " & TRIM(B1),C1)

    To "find" extra blanks in C

    =SUBSTITUTE(C1," ","*") which will replace blanks with "*" so it is easier to spot erroneous entries

    hope this helps

  8. #8
    Registered User
    Join Date
    02-10-2016
    Location
    Wayne, NJ
    MS-Off Ver
    2016
    Posts
    21

    Re: Using an IF statement to produce an error if data doesn't match in columns

    My apologies.... I realized I placed it in the wrong location after I submitted it. I am sorry.

  9. #9
    Registered User
    Join Date
    02-10-2016
    Location
    Wayne, NJ
    MS-Off Ver
    2016
    Posts
    21

    Re: Using an IF statement to produce an error if data doesn't match in columns

    Hi John,

    That will work!

    Thank you!
    Babs

  10. #10
    Registered User
    Join Date
    02-10-2016
    Location
    Wayne, NJ
    MS-Off Ver
    2016
    Posts
    21

    Re: Using an IF statement to produce an error if data doesn't match in columns

    Thanks Chemist B and mrice.... You have all been very helpful!!!!

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,002

    Re: Using an IF statement to produce an error if data doesn't match in columns

    Thanks for the feedback and rep.

    If your problem has been solved could you please mark the thread as such ("Thread Tools" at top of first post)

  12. #12
    Registered User
    Join Date
    02-10-2016
    Location
    Wayne, NJ
    MS-Off Ver
    2016
    Posts
    21

    Re: Using an IF statement to produce an error if data doesn't match in columns

    Hi John,

    Thank you for showing me where that could be found

    Done!
    babs

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to Map data columns in two different excel files and produce data in third file
    By promaxbusiness in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 12-15-2015, 01:40 AM
  2. [SOLVED] Match Data in two column and produce another data.
    By ryoka012 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-17-2015, 02:29 AM
  3. [SOLVED] Ensure running a macro doesn't produce duplicate data
    By mhenry123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2013, 09:33 PM
  4. [SOLVED] VBA Code to Produce Multiple Pie Charts (data in columns)
    By Janc in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 10-30-2012, 06:48 AM
  5. Macro formula to match two columns and Produce result in fourth column.
    By rishi1983 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-03-2012, 08:50 PM
  6. Formula doesn’t produce the required data
    By alan_stephen75@ in forum Excel General
    Replies: 3
    Last Post: 10-04-2010, 01:03 PM
  7. Printout doesn't match screen view (columns wrap differently).
    By SheriBee in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1