+ Reply to Thread
Results 1 to 7 of 7

VBA -- Compare two dates and map "Yes" or " No" -- Getting Syntax Error at FormulaR1C1

  1. #1
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2016
    Posts
    110

    VBA -- Compare two dates and map "Yes" or " No" -- Getting Syntax Error at FormulaR1C1

    Dear all,

    I'm trying to compare two dates from two different column values. If they are same, I need to map as "Yes" and otherwise "No".

    I've written a Formula and getting an error at the following line in my code:

    Please Login or Register  to view this content.
    Goal is to calculate the same using formula.

    Ex:

    A B C
    Emp No Start Date Term Date No Show?
    1 3/6/2017 3/6/2017
    2 11/28/2016

    In the end, value under "No Show?" column should be:

    =IF(A2=B2),"Yes","No"

    PFA for the sheet with error at the code mentioned above.

    Request your help in fixing this line of code

    Thanks,
    Vinod Krishna
    Attached Files Attached Files
    Last edited by Vinod Krishna.C; 05-21-2018 at 12:25 AM.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: VBA -- Compare two dates and map "Yes" or " No" -- Getting Syntax Error at FormulaR1C1

    Why not just place this formula in cell D2 and copy it down:
    =IF(B2=C2,"Yes","No")
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2016
    Posts
    110

    Re: VBA -- Compare two dates and map "Yes" or " No" -- Getting Syntax Error at FormulaR1C1

    Hi Mumps1,

    Columns " Start Date " and " Term Date " can change positions. the above coding logic is part a bigger macro and it is important for me to achieve this using VBA.

    Thanks,
    Vinod Krishna

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,274

    Re: VBA -- Compare two dates and map "Yes" or " No" -- Getting Syntax Error at FormulaR1C1

    Here you go.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: VBA -- Compare two dates and map "Yes" or " No" -- Getting Syntax Error at FormulaR1C1

    Try:
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2016
    Posts
    110

    Re: VBA -- Compare two dates and map "Yes" or " No" -- Getting Syntax Error at FormulaR1C1

    Thanks Mump1. Your Formula helped me correct my code.

    Please see the corrected code below:

    Please Login or Register  to view this content.
    Regards,
    Vinod Krishna

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: VBA -- Compare two dates and map "Yes" or " No" -- Getting Syntax Error at FormulaR1C1

    You are very welcome.

+ 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. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  2. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  3. Replies: 35
    Last Post: 01-13-2016, 02:16 AM
  4. IF Statement to compare two dates and insert "Yes" or "No" in a third cell
    By tbrookes3 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-03-2015, 11:44 PM
  5. = EMBED("Forms.ComboBox.1","") error "Reference not valid."
    By CatharinaCatharina in forum Excel General
    Replies: 2
    Last Post: 12-11-2014, 09:58 AM
  6. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  7. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 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