+ Reply to Thread
Results 1 to 10 of 10

Assistance in updating formula for DATE functions - eg DateValue

  1. #1
    Registered User
    Join Date
    04-15-2013
    Location
    Australia
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    57

    Assistance in updating formula for DATE functions - eg DateValue

    To Whom It May Concern

    I would like some assistance writing/amending a formula, that uses all three

    * DATEVALUE

    * IF(AND(OR(

    and

    "AND"

    functions.

    I've attached a spreadsheet (containing only the necessary data, nothing else), however, I will explain how I intend to use it.

    Firstly, two Sheets are in the attachment: (titled), "Income & Cash or Debit Expenses" & "Pharmaceuticals List".

    On the "Income & Cash or Debit Expenses" sheet, go to Cells A7 and/or B7.

    In Cell A7, the formula looks like this:

    =(IF($B$7=(((((""))))), (((((""))))), (IF('Income & Cash or Debit Expenses'!$A$1=(((((""))))), (((((""))))), (IF(DAY('Income & Cash or Debit Expenses'!$A$3)<>365, (IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={3,4,5,6,7,8,9})), "Food and Groceries*; * Maximum spend per week, $100.00, and Medicines/Pharmacy (Refer: 'Pharmaceuticals List' sheet, for more information.), (Add extra, $50.00*2/f cash withdrawal for Adelaide Oval Cash Card (incorporating AFL & AFLW))", ((IF('Income & Cash or Debit Expenses'!$A$1=(((((""))))), (((((""))))), (IF(DAY('Income & Cash or Debit Expenses'!$A$3)<>365, (IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={8,9,10,11})), "Food and Groceries*; * Maximum spend per week, $100.00, and Medicines/Pharmacy (Refer: 'Pharmaceuticals List' sheet, for more information.), (Add extra, $50.00*2/f cash withdrawal for Adelaide Oval Cash Card (incorporating AFL & AFLW))", ((IF('Income & Cash or Debit Expenses'!$A$1=(((((""))))), (((((""))))), (IF(DAY('Income & Cash or Debit Expenses'!$A$3)<>365, (IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={1,2,12})), "Food and Groceries*; * Maximum spend per week, $100.00, and Medicines/Pharmacy (Refer: 'Pharmaceuticals List' sheet, for more information.), (Add extra, $50.00/f cash withdrawal for personal use.)", ("")))))))))))))))))))))))

    and, in Cell B7, the formula looks like this:

    =(IF('Income & Cash or Debit Expenses'!$A$1=(((((""))))), (((((""))))), (IF(DAY('Income & Cash or Debit Expenses'!$A$3)<>365, (IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={3,4,5,6,7,8,9})), (SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*2))+(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*2)))*'Income & Cash or Debit Expenses'!$B$5), (IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={8,9,10,11})), (SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*2))+(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*2)))*'Income & Cash or Debit Expenses'!$B$5), (IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={12,1,2})), (SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2))+(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)))*'Income & Cash or Debit Expenses'!$B$5)))))))))))

    From this point, here's what I want to do, and would like assistance with:

    In Cell B7, I want to amend the formula above, to recalculate to show ONLY on/between a specific date period. For example:

    =IF(DATEVALUE>={13/4}, (SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*2))+(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*8)))*'Income & Cash or Debit Expenses'!$B$5), IF(DATEVALUE<={16/4}, (SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*2))+(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*8)))*'Income & Cash or Debit Expenses'!$B$5), AND (IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={3,4,5,6,7,8,9})), (SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*2))+(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*8)))*'Income & Cash or Debit Expenses'!$B$5)

    [HINT: Change "ONLY" (30*2) to show (30*8), to occur ONLY between dates 13/4 - 16/4 inclusive.]

    So, in other words, the formula will be =(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*8))+(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*8)))*'Income & Cash or Debit Expenses'!$B$5), only when date value is =>{13/4} or <={16/4}.

    Otherwise, if date is NOT specifically between (dates) 13/4 - 16/4 (inclusive), BUT is still within the MONTHS (of) {3,4,5,6,7,8,9}, the calculation is (then) =(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*2))+(SUM(100*2)+(SUM('Pharmaceuticals List'!$G$39)+(25*2)+(30*2)))*'Income & Cash or Debit Expenses'!$B$5)



    Footnote (1): Where an asterisk (*) appears before/after a word, eg "Food and Groceries*; * Maximum (etc)", in this context, the asterisk (*) is NOT referring to the "multiply" function.

    Footnote (2): "*'Income & Cash or Debit Expenses'!$B$5" (in this context, the asterisk (*) IS referring to the "multiply" function. (Multply (by) SheetName (and) Cell. [Manually change 'Income & Cash or Debit Expenses'!$B$5, to read either 0% or 10%, and this will change automatically on all other sheets. In Australia, the "Goods and Services Tax (GST)" is set at a maximum of 10%.]

    Footnote (3): In Australia, the date is written using the DD/MM/YYYY format, so as per the date example above, 13 April (DD/MM only), is written as 13/4, NOT 4/13 (April 13; US/international format).

    Thank you to anyone who assists me with this, and I have attempted to explain this as best I can; I apologise in advance for any confusion. Your assistance is most graciously welcomed and appreciated.

    Matthew

    By the way, I'm having trouble uploading the attachment. Please help.

  2. #2
    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,141

    Re: Assistance in updating formula for DATE functions - eg DateValue

    Death by brackets!

    Those formulae are hugely overcomplicated by the overuse of ().

    The formulae in the purple cells have been changed.

    Your description for B7 is incomplete.

    If date is between 15/4 and 16/4, use 8 as the multiplier.
    If date is Apr-October, use 2 as the multiplier,
    Otherwise, something else....

    Interim formula:

    =IF($A$1="","",IF(AND(MONTH($A$3)>=3,MONTH($A$3)<=9),(1+B5)*SUM(100*2+(SUM('Pharmaceuticals List'!$G$39+25*2+30*IF(AND($A$3>=DATE(2023,4,13),$A$3<=DATE(2023,4,16)),8,2)))),"Something else"))

    Please explain the "something else". I found it impossible to work my way through your multiple layers of ()
    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

  3. #3
    Registered User
    Join Date
    04-15-2013
    Location
    Australia
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    57

    Re: Assistance in updating formula for DATE functions - eg DateValue

    Hi Glenn

    Thank you for your reply to my post; much appreciated.

    Firstly, I have learnt that Excel forces me to use "excessive" brackets (), as it won't accept the formula (I'm entering), otherwise, given that the majority of my formulas in my spreadsheets are built using "IF" statements, and therefore, some functions are automated. I am limited in my experience with Excel and what you see, is based soley on what i have studied/learnt over time.

    If you can offer a more "tidy" or concise way to write my formulas, then I welcome any assistance you are willing to offer. Thank you.

    Additionally, I don't know what you refer to as "something else". Sorry, but this was not in my original formula when I attached my file to this post.

    Thank you, for what you have offered me, I appreciate it.

    Matthew

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,622

    Re: Assistance in updating formula for DATE functions - eg DateValue

    In terms of formula reduction,
    Formula: copy to clipboard
    Please Login or Register  to view this content.


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


    And
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by TMS; 04-08-2023 at 09:17 PM.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,622

    Re: Assistance in updating formula for DATE functions - eg DateValue

    Change 30*2 to IF(AND(MONTH(A3)=4, DAY(A3)>=13, DAY(A3)<=16), 30*8, 30*2)

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,622

    Re: Assistance in updating formula for DATE functions - eg DateValue

    Is this resolved now?

  7. #7
    Registered User
    Join Date
    04-15-2013
    Location
    Australia
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    57

    Re: Assistance in updating formula for DATE functions - eg DateValue

    Yes, it is. Thank you to you and all whom have assisted me.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,945

    Re: Assistance in updating formula for DATE functions - eg DateValue

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  9. #9
    Registered User
    Join Date
    04-15-2013
    Location
    Australia
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    57

    Re: Assistance in updating formula for DATE functions - eg DateValue

    Already done.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,622

    Re: Assistance in updating formula for DATE functions - eg DateValue

    You're welcome. Thanks for the rep.

    I would suggest you put the amendment into my formula, rather than yours.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If you want to make this a learning experience, some pointers:

    1. Don't put a bracket at the beginning of a formula. It just means you have to put one at the end.
    2. Adding lots of brackets adds no value: IF('Income & Cash or Debit Expenses'!$A$1=(((((""))))), (((((""))))) is the same as IF('Income & Cash or Debit Expenses'!$A$1="", ""
    3. Don't put brackets round a multiplication: (30*2) is the same as 30*2
    4. Don't use SUM when you don't need to. If there is only one parameter, you don't need it. If you are using plus signs inside the brackets, you don't need it. SUM takes a number of comma separated values. If you don't have a list of comma separated values, you don't need it.
    5. The AND in your IF(AND(OR(...))) in your formula is redundant. You don't have two conditions to AND together, although the OR is appropriate.
    6. If the formula refers to a cell/range on the same worksheet, don't fully qualify it with the sheet name. IF('Income & Cash or Debit Expenses'!$A$1="", "" is the same as IF($A$1="", ""
    7. There is also some redundancy in your formula. IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={3,4,5,6,7,8,9})) and IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={8,9,10,11})) have some overlap and the same outcome. They can be combined (as I did): IF(AND(OR(MONTH('Income & Cash or Debit Expenses'!$A$3)={3,4,5,6,7,8,9,10,11}))

    As Glenn said, overuse of brackets just makes the formula difficult to read ... and very long. Your original formula was 835 characters long. My tidied up version was 175 characters long. The adjusted formula is 229 including the date check.

+ 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: 3
    Last Post: 02-21-2023, 06:21 AM
  2. [SOLVED] Assistance with DATEVALUE Lookup in a table
    By equinox1974 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-26-2017, 11:33 PM
  3. Need assistance with a Date Formula
    By raider573 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-19-2017, 03:55 PM
  4. [SOLVED] Formula assistance needed to sum data based on anniversary date and month date
    By lilsnoop in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-28-2012, 11:18 PM
  5. Date or DateValue
    By ccsmith in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-09-2011, 07:24 AM
  6. [SOLVED] date formula assistance req'd
    By Bri in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-05-2006, 05:20 PM
  7. [SOLVED] HOW DO I ENTER THIS FORMULA TO CONVERT TEXT TO DATE =DATEVALUE(,
    By Carter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-15-2006, 10:20 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