+ Reply to Thread
Results 1 to 18 of 18

Add a between 2 dates to an IF statement

  1. #1
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Add a between 2 dates to an IF statement

    I have the following formula and I would like to add a between 2 dates to the IF AND statement.

    =IFERROR(INDEX('Weekly Income'!$E$3:$E$50000,SMALL(IF(('Weekly Income'!$B$3:$B$50000=$F$9+0)*('Weekly Income'!$C$3:$C$50000=$F$7),ROW('Weekly Income'!$A$3:$A$50000)-ROW('Weekly Income'!$A$3)+1,""),ROWS($A$3:A3))),"")

    The formula is in D16 and the 2 dates are in E2 and E4. I have attached a cut out of what the spreadsheet looks like.
    Attached Images Attached Images

  2. #2
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Add a between 2 dates to an IF statement

    I thought I would upload the file so where the data comes from can be seen.
    Last edited by myobreportguru; 08-16-2016 at 07:40 AM. Reason: upload file

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Add a between 2 dates to an IF statement

    Are you wanting it to look at the DUE date or the PAID date?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Add a between 2 dates to an IF statement

    Please attach a sample workbook. Make sure there is enough data to demonstrate your need. Make sure your desired results are shown, mock them up manually if necessary. Remember to remove ALL confidential information first!!!

    However, nothing on this Forum works quite as well as you might expect. The attachment icon doesn't work!! (Helpful, isn't it!!). Instead, just before you submit your post, click on GO ADVANCED (near the bottom) and then scroll down to Manage Attachments to open the upload window. The relevant instructions are at the top of that screen.

  5. #5
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Add a between 2 dates to an IF statement

    I would like all the data to be filtered according to the IF statements. Some data comes from the Weekly Archives worksheet and some from Weekly Income worksheet. I'm not real good at some of these formulas so I hope it can be done.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Add a between 2 dates to an IF statement

    That's not what I asked. In your main data, you have two columns with dates in them. The start and end dates are to apply to WHICH OF THOSE TWO COLUMNS?

  7. #7
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Add a between 2 dates to an IF statement

    ok make it Rent Due column.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Add a between 2 dates to an IF statement

    I misunderstood you. Apologies. Please upload an unprotected sheet.

  9. #9
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Add a between 2 dates to an IF statement

    sorry I didn't think it was protected. I'll check it and get back to you tomorrow. It's late here.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Add a between 2 dates to an IF statement

    OK. I got it figured. It wasn't protected. i was just being thick.

    The problem was that your cells linked to you control object (the date select boxes) were returning the ROW NUMBER not the value. Instead, I used regular data validation to populate the DD boxes.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    entered as an array. Array Formulae are a little different from ordinary formulas in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly braces { } appear around the outside of your formula. If you do not CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly braces yourself - it won't work...
    Attached Files Attached Files

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Add a between 2 dates to an IF statement

    it just occurred to me how you can continue to use your original set up:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Add a between 2 dates to an IF statement

    hello Glenn. I have moved the layout around a bit and I want to produce a report that doesn't have the date range in it but still used for the calculation. So I will just adjust the print layout when I have the report ready. I have entered your formula in F16, is that where you meant this formula to be? I haven't changed any other formulas on the page yet so they are as I did them originally but I will change them all when I get it all working correctly. Can you check this for me please? I will upload a fresh copy of the file. Thanks.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Add a between 2 dates to an IF statement

    OK. You have changed the properties of your combobox since the last version of this. It is now putting the date (not the row number of the date), formatted as text, in the linked cell. So there is now no need to use INDEX to refer to the start and end dates. You now just need to refer to D2 and D4 and add zero. In the INDEX part of the formula you had changed my whole column reference to match the range. Don't. Leave it as a whole column reference; otherwise it will give you an incorrect result.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Final working version is in the green cells, starting at F13, array entered.


    I haven't a clue what you mean by "I want to produce a report that doesn't have the date range in it but still used for the calculation".
    Attached Files Attached Files

  14. #14
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Add a between 2 dates to an IF statement

    yes yes yes thankyou Glenn. I've still got a bit of building to go but I think I've got it. By producing a report I meant just selecting the print range to exclude the date range. I won't put solved yet, I'll come back after I've done a bit more work. Thanks again.

  15. #15
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Add a between 2 dates to an IF statement

    Hi Glenn

    I have uploaded my latest version of this file. It's a little bit confusing the names are written differently on the 2 worksheets for the same people so I had to create a dropdown list from each worksheet to use with the formulas for data from each worksheet. However could you check the first formula in each column, I'm not sure about the row and rows part of the formula in each column. I've got a fair bit to learn yet.

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Add a between 2 dates to an IF statement

    Here it is, slightly changed.

    ROW should cover the same range as the criteria-based matches (i.e. 2 to 50000). It returns the row number that matches your criteria. SMALL and a counter help to return the actual values in the order in which they appear.

    ROWS is the counter. I normally set the first line to be ROWS($1:1) - which will return 1, copying down gives ROWS($1:2) - which gives 2, etc. Others prefer to start the counter in the cell in which the result is generated. So in cell F14, they'd have ROWS($F$14:F14).

  17. #17
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Add a between 2 dates to an IF statement

    Thank you Glenn. I'm extremely grateful for your help.

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: Add a between 2 dates to an IF statement

    You're welcome and thanks for the Reputation.

+ 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. If Statement Between 2 Dates
    By Chia4 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-13-2016, 08:19 PM
  2. If statement with dates
    By itshere in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-09-2015, 11:33 AM
  3. HELP! IF statement containing DATES
    By ohiamluis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-08-2013, 01:05 PM
  4. IF STATEMENT and Dates
    By gballard in forum Excel General
    Replies: 6
    Last Post: 05-30-2012, 03:31 PM
  5. IF statement and dates
    By jacko311 in forum Excel General
    Replies: 2
    Last Post: 05-15-2009, 10:20 AM
  6. using dates in IF statement
    By bigchuda in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-28-2008, 02:55 PM
  7. Dates and if statement
    By FSCGunslinger in forum Excel General
    Replies: 7
    Last Post: 02-12-2008, 08:39 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