+ Reply to Thread
Results 1 to 16 of 16

Calculation Formula for dates in different format

  1. #1
    Forum Contributor
    Join Date
    01-02-2015
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    2007
    Posts
    272

    Calculation Formula for dates in different format

    Hi All,

    Appreciate if anyone out there can help me on a formula on dates. I have an excel(attached) with 3 columns as below. Im trying to get Column C to calculate the days remaining from column B (B2-Now()) and if column D shows as Delivered then it should show as Done. Im having 3 problems as below:

    Test File.xlsx

    1) My formula in Column C cannot calculate more than 30 days.
    2) Unable to map if Column C is Expired and Column D is Delivered then Column C should show as Done instead of ExpiredDone.
    3) Is there anyway to calculate in Column C if column B shows value as Q2, 2016 instead of mmmm dd,yyyy

    Yes it is very complicating to me and for the life of me I cannot think of another way to make this work. :-(

    Kind Regards,
    Mark.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Calculation Formula for dates in different format

    My approach:
    If status = Done, =>Done
    If Date = Q1,2016, convert to first date of Q1,2016 = 01-Jan-2016 (similar to Q2: 01-Apr-2016 and so on)
    If remaining date>30, displays "more than 30 days"

    In C2:

    Please Login or Register  to view this content.
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    01-02-2015
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    2007
    Posts
    272

    Re: Calculation Formula for dates in different format

    Quote Originally Posted by bebo021999 View Post
    My approach:
    If status = Done, =>Done
    If Date = Q1,2016, convert to first date of Q1,2016 = 01-Jan-2016 (similar to Q2: 01-Apr-2016 and so on)
    If remaining date>30, displays "more than 30 days"

    In C2:

    Please Login or Register  to view this content.
    Hello Bebo,

    Nice to hear from you again. This works almost 99% for me. The remaining 1% would be if I could see those days ranging from 1 Day - 90 Days and the rest "More than 90 Days". Sadly 30 days does not work well for me. Anyway to have this? Tried changing your formula to >90 but does not seem to work. :-(

    Kind Regards,
    Mark.

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Calculation Formula for dates in different format

    Not sure why Sucuri WebSite Firewall is not allowing me to post the formula here....
    Please find the attached workbook to see if this is what you are trying to achieve.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Forum Contributor
    Join Date
    01-02-2015
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    2007
    Posts
    272

    Re: Calculation Formula for dates in different format

    Quote Originally Posted by sktneer View Post
    Not sure why Sucuri WebSite Firewall is not allowing me to post the formula here....
    Please find the attached workbook to see if this is what you are trying to achieve.
    Hi Sktneer,

    Yes this works like how i needed it. Only one thing though. Is it possible for the each Q1 to calculate as the last day of the Quarter instead of the first day?

    Kind Regards,
    Mark.

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Calculation Formula for dates in different format

    Still unable to post the formula...
    Tweaked the formula in a new column in the attached.
    Attached Files Attached Files

  7. #7
    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,209

    Re: Calculation Formula for dates in different format

    @sktneer

    Previous posts suggest the problem with Sucuri firewall could be ">" in a formula: apparently adding blanks as prefix/suffix gets round the problem

    Assuming this is your formula:

    =IF(D2="Delivered","Done",IF(B2 < TODAY(),"Expired",IF(LEFT(B2,1)="Q",DATE(RIGHT(B2,4),CHOOSE(MID(B2,2,1),1,4,7,10),1)-TODAY(),B2-TODAY())&" Days"))

  8. #8
    Forum Contributor
    Join Date
    01-02-2015
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    2007
    Posts
    272

    Re: Calculation Formula for dates in different format

    Quote Originally Posted by sktneer View Post
    Still unable to post the formula...
    Tweaked the formula in a new column in the attached.
    Hi sktneer,

    Tried that formula for Q1, 2016 and it shows 13 Days. Must be some mistake there as it should show 73 Days instead as the end of Q1 is March 31st.

    Kind Regards,
    Mark.

  9. #9
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Calculation Formula for dates in different format

    @John
    Thanks for the information. I had no clue about that. lol

    @Mark
    Please replace the previous formula with the following one...
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    01-02-2015
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    2007
    Posts
    272

    Re: Calculation Formula for dates in different format

    Quote Originally Posted by sktneer View Post
    @John
    Thanks for the information. I had no clue about that. lol

    @Mark
    Please replace the previous formula with the following one...
    Please Login or Register  to view this content.
    Hi sktneer,

    Yes that works perfectly although when I do conditional formatting for cells less than 30 days to show it as Red, it appears other cells with value above 100+ days also becomes Red. Is it because the values are not in "dd" format?

    Kind Regards,
    Mark.

  11. #11
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Calculation Formula for dates in different format

    Change your formula to the following one.....
    Please Login or Register  to view this content.
    Now select the formula cells --> Right click and choose Format Cells --> From the Number Tab select Custom and in the Type box, type the following format and click OK.
    Please Login or Register  to view this content.
    This custom formatting will add the text Days to the numbers in the formula cells. Now you may apply conditional formatting for the formula cells with Conditional Formatting --> Highlight Cells Rules --> Less than 30 and set the format as per your choice.

  12. #12
    Forum Contributor
    Join Date
    01-02-2015
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    2007
    Posts
    272

    Re: Calculation Formula for dates in different format

    Quote Originally Posted by sktneer View Post
    Change your formula to the following one.....
    Please Login or Register  to view this content.
    Now select the formula cells --> Right click and choose Format Cells --> From the Number Tab select Custom and in the Type box, type the following format and click OK.
    Please Login or Register  to view this content.
    This custom formatting will add the text Days to the numbers in the formula cells. Now you may apply conditional formatting for the formula cells with Conditional Formatting --> Highlight Cells Rules --> Less than 30 and set the format as per your choice.
    Hi sktneer,

    Yes, this works perfectly...Many thanks for your help. :-)

    Kind Regards,
    Mark

  13. #13
    Forum Contributor
    Join Date
    01-02-2015
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    2007
    Posts
    272

    Re: Calculation Formula for dates in different format

    Quote Originally Posted by sktneer View Post
    Change your formula to the following one.....
    Please Login or Register  to view this content.
    Now select the formula cells --> Right click and choose Format Cells --> From the Number Tab select Custom and in the Type box, type the following format and click OK.
    Please Login or Register  to view this content.
    This custom formatting will add the text Days to the numbers in the formula cells. Now you may apply conditional formatting for the formula cells with Conditional Formatting --> Highlight Cells Rules --> Less than 30 and set the format as per your choice.
    Hi sktneer,

    Yes, this works perfectly...Many thanks for your help. :-)

    Kind Regards,
    Mark

  14. #14
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Calculation Formula for dates in different format

    You're welcome Mark! Glad I could help.
    And thanks for the feedback as well.

  15. #15
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Calculation Formula for dates in different format

    @sktneer, your formula to define last day of quarter:

    ...DATE(RIGHT(B2,4),CHOOSE(MID(B2,2,1),3,6,9,12),IF(OR(MID(B2,2,1)="2",MID(B2,2,1)="3"),30,31))

    could be simpler with another approach: define the 1st of next month then subtract 1

    ...DATE(RIGHT(B2,4),CHOOSE(MID(B2,2,1),4,7,10,13),1)-1

  16. #16
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Calculation Formula for dates in different format

    Yes that is correct.

+ 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. [SOLVED] Date format for two dates in a concatenated formula text included in the formula?
    By bkanealy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-12-2015, 04:33 PM
  2. Replies: 5
    Last Post: 10-24-2014, 12:42 AM
  3. Replies: 1
    Last Post: 07-09-2014, 05:57 AM
  4. [SOLVED] What formula can I use to format Dates?
    By djmatok in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-12-2014, 05:47 PM
  5. [SOLVED] excel formula to help my calculation from min dates of 3 dates cell ranges
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-04-2013, 10:32 AM
  6. [SOLVED] Time calculation formula in excel and conditional format
    By Subhash Sarker in forum Excel General
    Replies: 4
    Last Post: 10-15-2012, 12:18 PM
  7. How do I format dates accessed by a formula
    By Mont22 in forum Excel General
    Replies: 3
    Last Post: 01-12-2005, 01:06 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