+ Reply to Thread
Results 1 to 10 of 10

date/text formula which propagates on drag

  1. #1
    Registered User
    Join Date
    11-10-2009
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    25

    date/text formula which propagates on drag

    Hello All,

    I am using Excel 2003 (or Excel 2007 if needed) and have the following problem, which I can not find an answer to.

    The template will start with 'Day 01' in cell A1. If I have been given the date, I will change cell A1 to the date, but want to the other cells in column A to change automatically based on the contents of cell A1.

    In Cell 'A1' default is 'Day 01' or I may change it to actual date '31-02-13'

    In Cell A2, I want to show either 'Day 02', or the date '01-03-13'.

    If I enter =SUM(A1)+1, cell A2 will display as 01-01-00, digits (or some other format(. I have tried various formats but it doesn't work.

    Secondly, I tried the following IF statement in Cell A2:
    =IF(A1="Day 01","Day 02",(A1+1))

    The problem is, when I drag that function into cell A3, the function is
    =IF(A2="Day 01","Day 02",(A2+1)) - the two bits in quotes are not incremental.

    Any ideas what kind of formula I can use to solve my little problem?

    Thanks!
    Andy
    Last edited by yesmaybe; 11-08-2012 at 01:54 AM. Reason: solved

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: date/text formula which propagates on drag

    Hi YesMayBe,

    31-02-13 will not work as Feb 31 will never come

    Otherwise, it should work when you add +1 to the below formulas .. if you still face issue, upload a small sample workbook.. thanks,

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Registered User
    Join Date
    11-10-2009
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: date/text formula which propagates on drag

    Well spotted on the date

    Here is a sample of the problems I am having.

    As you can see, I can not format the cell for both text and a date.
    Also, I can not make the IF statement work incrementally when I drag down the column.

    date-if-sample.xls

    Thanks for your support.

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: date/text formula which propagates on drag

    Hi YesMayBe,

    See the two options in column F and I in attached workbook.. thanks.
    date-if-sample.xls

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  5. #5
    Registered User
    Join Date
    11-10-2009
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: date/text formula which propagates on drag

    thanks for those suggestion dilipandey.

    However, how to combine them both in one cell? I tried to add the formula in F2 to the formula in A10, but it produced an error.

    I am trying to make it so the date or day will display, depending what is in the cell above.

    Andy

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: date/text formula which propagates on drag

    Ok.. try below formula:-

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


    To test this, enter either the day ## or any date in yellow cell and watch the results in green cell in below attachment:-
    date-if-sample.xls

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  7. #7
    Registered User
    Join Date
    11-10-2009
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: date/text formula which propagates on drag

    Thanks Dilipandey, you are a star and a gentleman, that code worked perfectly.

    Please help me learn, what does VALUE(RIGHT(H15,3)) mean? Why 'right' and why '3'?

    Thank you again.

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: date/text formula which propagates on drag

    Ok.. here is the explanation:-

    Why right and Why 3?
    VALUE(RIGHT(H15,3))
    Right is a function which is extracting 3 characters from right and then Value function converts that into a value (removing extra spaces and converting the number from text format to number in number format


    Hope this helps.. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  9. #9
    Registered User
    Join Date
    11-10-2009
    Location
    China
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: date/text formula which propagates on drag

    Hi and thanks for the lesson.

    I found this page with more info on the RIGHT function, http://www.techonthenet.com/excel/formulas/right.php

    Thanks for your speedy and knowledgable reply.
    Andy

  10. #10
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: date/text formula which propagates on drag

    You are welcome YesMayBe

    cheeers

    Regards,
    DILIPandey


    <click on below 'star' if this helps>

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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