+ Reply to Thread
Results 1 to 7 of 7

Need help creating a formula to check a date range

  1. #1
    Registered User
    Join Date
    07-21-2014
    Location
    florida
    MS-Off Ver
    2013
    Posts
    19

    Need help creating a formula to check a date range

    I want to know if a sales deal is active. I need the formula to go in column N on the Test page. I need it to match the following criteria to the Deals sheet. The formula should lookup/ match ship to: C1, then material number in column: A, and then look to see if the date in cell: C6 falls between the two dates on the Deals sheet. Is there a way to leave the cells in column N that do not have a sales deal blank? Ex: Ship To 43354 and Material 422436 would show active or not and material 280138 would be left blank. I have tried some formulas but I think this one is beyond my grasp of excel knowledge. Thanks in advanced!
    Attached Files Attached Files
    Last edited by bbeards2; 10-20-2015 at 04:32 PM. Reason: Solved

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

    Re: Need help creating a formula to check a date range

    In N8 copied down

    =IFERROR(IF(AND(Test!$C$6>= INDEX(Deals!$E$2:$E$1000, MATCH(Test!$C$1, Deals!$G$2:$G$1000,0)), Test!$C$6<= INDEX(Deals!$F$2:$F$1000, MATCH(Test!$C$1, Deals!$G$2:$G$1000,0))), "Valid", "Not Valid"), "")

    Assumptions:
    1. All of your formatting on Deals and Test are the same. They are not. I converted Deals!Column G to Text to match Test!C1 and Changed Test!C6 from text to Date to match columns E and F on Deals!

    2. You only have 1 deal per "shipped to" on the Deals sheet. Is this true? If not, will you have multiple deals with the same Material or one per material? What critieria would you use to determine Valid vs Invalid?
    Attached Files Attached Files
    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

  3. #3
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Need help creating a formula to check a date range

    There were some inconsistencies within your provided workbook regarding values stored as text vs. numbers, so I altered a few of those in my proposed workbook. Change the ranges of the formula to match your data accordingly.
    Attached Files Attached Files
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  4. #4
    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,199

    Re: Need help creating a formula to check a date range

    Try in N8 of TEST

    =IF(COUNTIFS(Deals!G:G,Test!$C$1,Deals!N:N,Test!$A8,Deals!E:E,"<=" &Test!$C$6,Deals!F:F,">=" &Test!$C$6),"Deal Active","")

  5. #5
    Registered User
    Join Date
    07-21-2014
    Location
    florida
    MS-Off Ver
    2013
    Posts
    19
    Quote Originally Posted by ChemistB View Post
    In N8 copied down

    =IFERROR(IF(AND(Test!$C$6>= INDEX(Deals!$E$2:$E$1000, MATCH(Test!$C$1, Deals!$G$2:$G$1000,0)), Test!$C$6<= INDEX(Deals!$F$2:$F$1000, MATCH(Test!$C$1, Deals!$G$2:$G$1000,0))), "Valid", "Not Valid"), "")

    Assumptions:
    1. All of your formatting on Deals and Test are the same. They are not. I converted Deals!Column G to Text to match Test!C1 and Changed Test!C6 from text to Date to match columns E and F on Deals!

    2. You only have 1 deal per "shipped to" on the Deals sheet. Is this true? If not, will you have multiple deals with the same Material or one per material? What critieria would you use to determine Valid vs Invalid?
    Thank you for the quick response. There will be other sales deals that have matching material numbers but some might have matching dates but will have different ship to's. I updated the spreadsheet with a little more data. Would you be able to adjust the formula to work with the new sales deals I added to Ship To 12345? Thank you for your help!
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-21-2014
    Location
    florida
    MS-Off Ver
    2013
    Posts
    19

    Re: Need help creating a formula to check a date range

    Quote Originally Posted by JohnTopley View Post
    Try in N8 of TEST

    =IF(COUNTIFS(Deals!G:G,Test!$C$1,Deals!N:N,Test!$A8,Deals!E:E,"<=" &Test!$C$6,Deals!F:F,">=" &Test!$C$6),"Deal Active","")
    Thank you for the quick response is there a way to show if the deal is inactive but leave the material that does not have a deal blank so if you look at the above spreadsheet I just attached material 280138 does not have a sales deal at all would remain blank but still show the others that have sales deals as active or inactive?

  7. #7
    Registered User
    Join Date
    07-21-2014
    Location
    florida
    MS-Off Ver
    2013
    Posts
    19

    Re: Need help creating a formula to check a date range

    I guess I am leaving out the fact that I will eventually want to hide the base price, tier price, and sales deal column so the only thing that can be seen is the best price as well as sales deal active.

+ 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: 7
    Last Post: 07-14-2017, 12:04 PM
  2. Help creating a formula or VB code to work if a date is within a certain range.
    By npsnps in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2015, 02:36 PM
  3. Check a date range and return value based on the date range
    By KeithCar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-13-2015, 12:55 PM
  4. [SOLVED] Formula to check date range and then do calculation
    By ps65 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2014, 07:54 PM
  5. excel formula help to get date from range as per check criteria
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2013, 06:03 AM
  6. conditional formatting formula to check frequency of occurence in date range?
    By seanblanton in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-27-2013, 05:50 PM
  7. Formula to Check Column A for date range and count Column B
    By realniceguy5000 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-28-2009, 12:58 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