+ Reply to Thread
Results 1 to 5 of 5

If(And comparing text and a date to the current year

  1. #1
    Forum Contributor
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    114

    If(And comparing text and a date to the current year

    Hello.

    I am having an issue getting a formula to work properly. In cell "A5" I have a date (9/20/2020). In Cell "L5" I have some text. Lastly, on another sheet I have a year that is generated from a formula (2020) in cell "G9". I am trying to write a If(And statement that will match the text to "L5" and the year to "'Sheet1'!G9" and return a 1. If it does not match then stay blank.

    I have the below formula and it returns a blank.

    Please Login or Register  to view this content.
    I am wondering if its because the date in A5 is not just a year but a full date? Any help would be greatly appreciated.

    Thank you.

  2. #2
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,266

    Re: If(And comparing text and a date to the current year

    Try
    =IF(AND(ISTEXT(L5),YEAR(A5)='Sheet1'!G9),1,"")

    Good luck!

  3. #3
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,266

    Re: If(And comparing text and a date to the current year

    Or
    =IF(AND(L5="Text",YEAR(A5)=VALUE('Sheet1'!G9)),1,"")

  4. #4
    Forum Contributor
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    114

    Re: If(And comparing text and a date to the current year

    Thank you. That second formula worked perfectly. I guess I was missing the =Value part of it. Makes sense in retrospect. Thank you again.

  5. #5
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,266

    Re: If(And comparing text and a date to the current year

    You're welcome! Glad to help.
    Thank you for the feedback and the rep points added.

+ 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: 1
    Last Post: 02-28-2020, 04:15 AM
  2. vba if any date in not belongs to current year then convert the date in current year
    By nkashyap3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-31-2019, 07:13 AM
  3. [SOLVED] Set PivotTable Filter to Current Day, Current Week, Current Month, or Current Year
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2014, 08:31 AM
  4. Replies: 3
    Last Post: 09-04-2013, 10:49 AM
  5. [SOLVED] Need Calculation - If A1=Annual, Anniv. Date for Current Year, else Biennial Date
    By TaxAnnihilator in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-11-2013, 06:06 PM
  6. [SOLVED] Keeping a date as current year, even though formula determines previous year
    By dropanddrive03 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-28-2013, 08:31 PM
  7. [SOLVED] Comparing a year value OR a specific word to the current year.
    By dtrimble in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-13-2012, 05:57 PM

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