+ Reply to Thread
Results 1 to 15 of 15

return a value of date using addition from 2 columns that represent a date and a number

  1. #1
    Registered User
    Join Date
    01-02-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    22

    return a value of date using addition from 2 columns that represent a date and a number

    I want to get a return value of date in column C whereas column A represent a date and column B represent a number. Simplest formula in excel is Column C (Feb 26, 2014)= Column A (Feb 21, 2014) + Column B (5). I want it to have in macro code. Thank you!

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Try this code....

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Hi, :) Sixthsense :),

    Concatenation between Date and Alphanumeric character like S should be made by using ampersand, not plus?

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    01-02-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    BTW I want to insert this code in a change event trigger and this code should be present in the columns I've mentioned.

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Holger,

    Not sure from where you got the alpha?

    Quote Originally Posted by jayce_sos View Post
    Column C (Feb 26, 2014)= Column A (Feb 21, 2014) + Column B (5). I want it to have in macro code
    Column A
    Feb 21, 2014

    Column B
    5

    Column C
    Feb 26, 2014

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Hi, :) Sixthsense :),

    my fault - I misread the 5 as S - maybe either have a go for new specs or change the font displayed (at least the size of it).

    Ciao,
    Holger

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Hi, jayce_sos,

    maybe like this:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  8. #8
    Registered User
    Join Date
    01-02-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Sixthsense,

    I tried your code but its keep on computing. I have to terminate the xls file.

  9. #9
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Hi Holger,

    It will be easier for us if the OP's shows the data in the way I shown in Post #5 without mingling it with the running text

  10. #10
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Hi, jayce_sos,

    could you please show the code that you used as I doubt you put in the code supplied without changes to it which could result in a loop. Maybe try the event-code I supplied.

    Ciao,
    Holger

  11. #11
    Registered User
    Join Date
    01-02-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Holger,

    You've nailed it brother! Thank you!

  12. #12
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Quote Originally Posted by jayce_sos View Post
    I tried your code but its keep on computing
    Because it's working with entire range of data which is designed based on the post #1 description.

    For your revised requirement, use the code provided by Holger in Post #7.

  13. #13
    Registered User
    Join Date
    01-02-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Holger,

    You've nailed it brother! Thank you!

  14. #14
    Registered User
    Join Date
    01-02-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Thanks also Sixthsense!

  15. #15
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: return a value of date using addition from 2 columns that represent a date and a numbe

    Hi, jayce_sos,

    you could make it more failproof by restricting it to the used range on the sheet as well as add a check if both cells are filled (this code will delete column C if Column A is empty and place date from A to C if B is empty):

    Please Login or Register  to view this content.
    Ciao,
    Holger

+ 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. represent date in text
    By Ashurk77 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-22-2013, 05:42 PM
  2. Replies: 15
    Last Post: 04-08-2013, 12:40 PM
  3. [SOLVED] Lookup Three Columns and return max date
    By dssrun209 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-19-2013, 06:43 PM
  4. [SOLVED] Return Max value of two columns IF date criteria is met
    By Medir in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-06-2013, 07:45 AM
  5. Add a number to date and return a weekday
    By dwain in forum Excel General
    Replies: 3
    Last Post: 10-13-2008, 10:55 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