+ Reply to Thread
Results 1 to 26 of 26

Need to add Date to get a single number

  1. #1
    Registered User
    Join Date
    12-19-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Need to add Date to get a single number

    Hi,

    Wanted to get assistance of adding the date Eg (today's date 26-09-2022 = 8+9+6 = 23 = 5

    Regards
    Raghavendra KR

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Need to add Date to get a single number

    Just to be sure I've got this right, you want to total the numbers in the individual sections eg 26 = 2+6 = 8 and then total those sections and onwards until you end up with a single digit?
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Need to add Date to get a single number

    Welcome to the forum.

    =IF(DAY(A1)>9,LEFT(DAY(A1),1),0)+RIGHT(DAY(A1),1)+IF(MONTH(A1)>9,LEFT(MONTH(A1),1),0)+RIGHT(MONTH(A1),1)+LEFT(YEAR(A1),1)+MID(YEAR(A1),2,1)+MID(YEAR(A1),3,1)+RIGHT(YEAR(A1),1)

    Set cell format to GENERAL.
    Last edited by AliGW; 09-26-2022 at 06:49 AM. Reason: Typo corrected.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Need to add Date to get a single number

    @AliGW If I'm reading the original correctly then the result could then need adding again? ie that calc correctly gives 23 but the example seems to say we'd need to get 5 from that?

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Need to add Date to get a single number

    You can use Expression.Evaluate with Power Query but not with XL2007

  6. #6
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Need to add Date to get a single number

    Quote Originally Posted by AliGW View Post
    =IF(DAY(A1)>9,LEFT(DAY(A1),1),0)+RIGHT(DAY(A1),1)+IF(MONTH(A1)>9,LEFT(MONTH(A1),1),0)+RIGHT(MONTH(A1),1)+LEFT(YEAR(A1),1)+MID(YEAR(A1),2,1)+MID(YEAR(A1),3,1)+RIGHT(YEAR(A1),1)
    Quick amendment to Ali's formula above

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Need to add Date to get a single number

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

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Need to add Date to get a single number

    @AliGW If I'm reading the original correctly then the result could then need adding again? ie that calc correctly gives 23 but the example seems to say we'd need to get 5 from that?
    I can't post the amended formula (forum glitch), but:

    =LEFT(my_formula,1)+RIGHT(my_formula,1)

  9. #9
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Need to add Date to get a single number

    Quote Originally Posted by Fluff13 View Post
    Another possible solution
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I like to think that I'm good with Excel and Maths in general but I would hugely appreciate it if you could explain that one to me? It works, perfectly but I have to admit to not being able to see how

    its beautiful, I just dont understand how beautiful

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Need to add Date to get a single number

    It's based on the fact that the sum of the digits of any exact multiple of 9 will equal 9 (or a multiple thereof).
    We need to subtract 1 from the start number & add it back on after otherwise is you start with 18 you end up with 0 instead of 9

  11. #11
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,912

    Re: Need to add Date to get a single number

    Another way:

    =MOD(TEXT(A1,"ddmmyyyy")-1,9)+1

  12. #12
    Registered User
    Join Date
    12-19-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Need to add Date to get a single number

    HI experts,
    Need a help on adding the dates to single number

    Eg today's date 26-09-2022 = 8+9+6 = 23 = 5

    Regards
    Raghavendra KR

  13. #13
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Need to add Date to get a single number

    Easy enough with a custom function:

    Please Login or Register  to view this content.
    The in a cell:
    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  14. #14
    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,447

    Re: Need to add Date to get a single number

    One way:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    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


  15. #15
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Need to add Date to get a single number

    Formula for cell B3
    Please Login or Register  to view this content.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  16. #16
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Need to add Date to get a single number

    Already asked & answered. https://www.excelforum.com/excel-for...le-number.html
    Also reported as a duplicate.

  17. #17
    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,447

    Re: Need to add Date to get a single number

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

  18. #18
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Need to add Date to get a single number

    Administrative Note:

    Welcome to the forum.

    Unfortunately, this is a duplicate thread, and you are allowed only ONE thread per issue here.

    Please see Forum Rule #5 about thread duplication.

    Because both threads have responses I am merging them. Please take the time to review our rules. There aren't many, and they are all important.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  19. #19
    Registered User
    Join Date
    12-19-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Need to add Date to get a single number

    yes that correct what ever date is entered in the DD/MM/YYYY format must be added & then the final answer must be in Single digit

  20. #20
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Need to add Date to get a single number

    Have you tried any of the solutions already posted?

  21. #21
    Registered User
    Join Date
    12-19-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Need to add Date to get a single number

    Thank you so much its working fine, will check with other combinations also.

  22. #22
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Need to add Date to get a single number

    Who are you talking to?

  23. #23
    Registered User
    Join Date
    12-19-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Need to add Date to get a single number

    hope its not working for single digits eg., 1-1-2022 = 1+1+6 = 8

  24. #24
    Registered User
    Join Date
    12-19-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Need to add Date to get a single number

    its working, but sometimes the double digit does not come down to single digit.
    eg 29-12-2022 = 2 (final result)

  25. #25
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Need to add Date to get a single number

    Quote Originally Posted by raghukr View Post
    its working, but sometimes the double digit does not come down to single digit.
    eg 29-12-2022 = 2 (final result)
    Which solution are you using? When there are many posts offerings solutions you need to quote the one you are responding to.

  26. #26
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Need to add Date to get a single number

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

+ 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: 12
    Last Post: 06-10-2020, 04:10 PM
  2. Replies: 9
    Last Post: 03-12-2020, 05:29 AM
  3. Replies: 1
    Last Post: 01-16-2018, 02:28 AM
  4. Replies: 1
    Last Post: 04-06-2016, 07:02 AM
  5. Find corresponding date range based on single date and ID number
    By Mate70 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 03-28-2014, 10:56 AM
  6. Adding a single date and number to a max list of 20
    By khank in forum Excel General
    Replies: 16
    Last Post: 03-30-2011, 02:18 PM
  7. Reducing a date to a single number
    By Martindelica in forum Excel General
    Replies: 20
    Last Post: 03-31-2007, 07:05 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