+ Reply to Thread
Results 1 to 42 of 42

formula to write the dates of rest days for every employee in one cell

  1. #1
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    formula to write the dates of rest days for every employee in one cell

    Hello Everybody,
    Question: I want a formula to write the dates of rest days for every employee
    Note 1 "R" refers to rest days
    Note 2 "Row B" contains dates
    Note 3 The result are like this "01+07+13+19+20+26"
    Office:2007
    Limitations:Formula Only-No helper columns-No vba-No powerquery
    I hope you help me
    Attached Files Attached Files
    Last edited by leprince2007; 01-11-2018 at 07:23 AM.

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

    Re: formula to write the dates of rest days for every employee

    Use ConcatAll function:

    =ConcatAll(IF(B3:AC3="R",$B$2:$AC$2,""),"+")

    https://www.excelforum.com/excel-gen...ml#post4805510
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee

    Thank you Mr. Phuocam for your solution but I need a formula not a UDF

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

    Re: formula to write the dates of rest days for every employee

    You can use 28 IF

    =MID(IF(B3="R","+"&$B$2,"")&IF(C3="R","+"&$C$2,"")&IF(...),2,62)

  5. #5
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee

    It`s very very long

  6. #6
    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,260

    Re: formula to write the dates of rest days for every employee

    You only have the option of using ....

    CONCATENATE function (or the ampersand (&) operator)

    which will result is formula of the type posted by Phuocam.

    So you either suffer a long formula OR use a UDF like ConCatAll (which were developed because of the problem of long, complex concatenation formulae)

  7. #7
    Spammer
    Join Date
    01-08-2015
    Location
    Cali, Colombia
    MS-Off Ver
    365
    Posts
    302

    Re: formula to write the dates of rest days for every employee

    Hi, to all!

    If you have Excel 2016, you can use TEXTJOIN. If not, and if you don't want to use VBA, you can use helper columns (that you can hide if you want):

    Use this formulas:
    [AF3] : =AE3&IF(B3="R","+"&B$2,"")
    and drag it until column BG and down what you need (in your example, to row 8).

    [AD3] : =MID(BG3,2,99)
    and drag it down.

    Check file. Blessings!
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee

    I don't like helping column ,and they are many of them.
    What about textjoin formula??will it be shorter?

  9. #9
    Spammer
    Join Date
    01-08-2015
    Location
    Cali, Colombia
    MS-Off Ver
    365
    Posts
    302

    Re: formula to write the dates of rest days for every employee

    Quote Originally Posted by leprince2007 View Post
    What about textjoin formula??will it be shorter?
    Of course! you can use (if you have Excel 2016 with 365 suscription):
    [AD3] : =TEXTJOIN("+",,IF(B3:AC3="R",B$2:AC$2,""))

    This is an array formula. You must enter with Ctrl + Shift + Enter instead of Enter in AD3 and later copy or drag it down. Blessings!

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: formula to write the dates of rest days for every employee

    Here's an alternative that works for up to 14 Rest days

    In AD3 copied down

    =SUBSTITUTE(TEXT(SUMPRODUCT(IFERROR(AGGREGATE(15,6,B$2:AC$2/(B3:AC3="R"),{1,2,3,4,5,6,7}),0),100^{6,5,4,3,2,1,0}),"00+00+00+00+00+00+00+")&TEXT(SUMPRODUCT(IFERROR(AGGREGATE(15,6,B$2:AC$2/(B3:AC3="R"),{8,9,10,11,12,13,14}),0),100^{6,5,4,3,2,1,0}),"00+00+00+00+00+00+00"),"+00","")

    see attached
    Attached Files Attached Files
    Last edited by daddylonglegs; 01-10-2018 at 03:20 PM.
    Audere est facere

  11. #11
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee

    There is no textjoin in my office
    Please find another formula.

  12. #12
    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,260

    Re: formula to write the dates of rest days for every employee

    See post #10.

  13. #13
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee

    Thank you Mr.daddylonglegs for your formula ,but I need a formula for 31 rest days not 14 only

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

    Re: formula to write the dates of rest days for every employee

    The formula allows for 14 rest days out of the 28 or 31: do you have more than 14 rest days in a month?


    Extending the DLL formula

    =SUBSTITUTE(TEXT(SUMPRODUCT(IFERROR(AGGREGATE(15,6,B$2:AC$2/(B3:AC3="R"),{1,2,3,4,5,6,7}),0),100^{6,5,4,3,2,1,0}),"00+00+00+00+00+00+00+")&TEXT(SUMPRODUCT(IFERROR(AGGREGATE(15,6,B$2:AC$2/(B3:AC3="R"),{8,9,10,11,12,13,14}),0),100^{6,5,4,3,2,1,0}),"00+00+00+00+00+00+00+")&TEXT(SUMPRODUCT(IFERROR(AGGREGATE(15,6,B$2:AC$2/(B3:AC3="R"),{15,16,17,18,19,20,21}),0),100^{6,5,4,3,2,1,0}),"00+00+00+00+00+00+00+")&TEXT(SUMPRODUCT(IFERROR(AGGREGATE(15,6,B$2:AC$2/(B3:AC3="R"),{22,23,24,25,26,27,28}),0),100^{6,5,4,3,2,1,0}),"00+00+00+00+00+00+00+")&TEXT(SUMPRODUCT(IFERROR(AGGREGATE(15,6,B$2:AC$2/(B3:AC3="R"),{29,30,31}),0),100^{2,1,0}),"00+00+00"),"+00","")

  15. #15
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee

    Your formula doesnot work and it`s very long

  16. #16
    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,260

    Re: formula to write the dates of rest days for every employee in one cell

    It does work!

    See attached/
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    If I add another column ,it gives me Value Error
    If I put it in another cell ,it gives me Value Error
    I cannot use this formula in any other file.Why?

  18. #18
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    I think Aggregate formula isnot supported in office 2007
    I have office 2007 in work but I have office 2010 at home
    Sorry for that

  19. #19
    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,260

    Re: formula to write the dates of rest days for every employee in one cell

    .... perhaps changing the range ???? B$2:AC$2 to B$2:AF$2 for 31 columns

    I changed the range as above and works perfectly OK placing the formula anywhere..

    Re you last post: AGGREGATE is not in Excel 2007.
    Last edited by JohnTopley; 01-11-2018 at 06:23 AM.

  20. #20
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    See post #18
    Is there another replacement for aggregate formula?
    Can you make the formula a little shorter? because It`s very long

  21. #21
    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,260

    Re: formula to write the dates of rest days for every employee in one cell

    Why this obsession with everything being short: if there had been a way to make the AGGREGATE function shorter then DDL would have done so ( I only replicated the code). ? If you cannot have more than 14 rest days (50%!) in any month the DLLS's first formula will suffice.

    You do not like "helper" rows/columns nor VBA and now you complain about "long" formulae.

    If you have Office 2007 at work then this should be the one in your profile: people waste their valuable time on solutions which may not be viable at work.

    AGGREGATE is (sometimes) a substitute for INDEX/SMALL array formula but assuming these can be applied you are likely to have an even more complex formula.
    Last edited by JohnTopley; 01-11-2018 at 07:01 AM.

  22. #22
    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,101

    Re: formula to write the dates of rest days for every employee in one cell

    Leprince, you do come up with some very challenging problems. A friendly word of advice though. You often bring new requirements along AFTER members have spent a lot of time trying to help you.

    Can I suggest that you make it clear IN YOUR FIRST POST, what Excel version you want it to work for, whether VBA is acceptable or not, whether helper columns can be used or not, whether Power Query can be used or not, and so on.

    Otherwise you may find a smaller and smaller number of members who are prepared to help you - the remainder being totally frustrated by your introduction of additional restrictions on the sort of solution that you want; AFTER they have FREELY given some of their OWN TIME to you to help.
    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

  23. #23
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    Ok I will take your advice
    Thank you

  24. #24
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769
    Up.....up......up
    Is there anybody know a shorter or a simpler formula?

  25. #25
    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,101

    Re: formula to write the dates of rest days for every employee in one cell

    No.... apart from the obvious question.

    Why do you want a very complicated formula to concatenate the dates in this thread and another very complicated formula to count the concatenated dates in another thread? Would it not be much easier simply to count the Rs in the first place...

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

    Re: formula to write the dates of rest days for every employee in one cell

    See the attached file.
    Attached Files Attached Files
    Last edited by Phuocam; 01-12-2018 at 09:15 AM.

  27. #27
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    Thank you very much for your great solution but:
    1- I don't want helping cells or columns,the formula depends on cell "AE1"
    2-"Aggregate" formula doesnot work in office 2007,Can you replace it?
    3-Question:How do you depend on the same cell in your formula?or How does this formula work?
    Last edited by leprince2007; 01-12-2018 at 10:11 AM.

  28. #28
    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,260

    Re: formula to write the dates of rest days for every employee in one cell

    AS requested earlier, change your profile to 2007 as yet another person has wasted time believing the solution was for 2010.

  29. #29
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    Sorry I will change it now

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

    Re: formula to write the dates of rest days for every employee in one cell

    Quote Originally Posted by leprince2007 View Post
    2-"Aggregate" formula doesnot work in office 2007,Can you replace it?
    Used for Excel 2007:

    =IFERROR(IF($AE$1=1,INDEX($B$2:$AC$2,MATCH("R",B3:AC3,0)),AE3&IF($AE$1>COUNTIF(B3:AC3,"R"),"",
    "+"&INDEX($B$2:$AC$2,SMALL(INDEX(IF(B3:AC3="R",COLUMN($B$2:$AC$2)-1),0),$AE$1)))),"")

  31. #31
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    Can you answer my other questions,please?
    Last edited by leprince2007; 01-13-2018 at 04:06 AM.

  32. #32
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    I don't want helping cells or columns,the formula depends on cell "AE1".can you change this?

  33. #33
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: formula to write the dates of rest days for every employee in one cell

    You can amend my suggestion to be compatible with Excel 2007, e.g. like this

    =SUBSTITUTE(TEXT(SUM(IFERROR(SMALL(IF(B3:AC3="R",B$2:AC$2+0),{1,2,3,4,5,6,7}),0)*100^{6,5,4,3,2,1,0}),"00+00+00+00+00+00+00+")&TEXT(SUM(IFERROR(SMALL(IF(B3:AC3="R",B$2:AC$2+0),{8,9,10,11,12,13,14}),0)*100^{6,5,4,3,2,1,0}),"00+00+00+00+00+00+00"),"+00","")

    ...but now an array formula that needs to be confirmed with CTRL+SHIFT+ENTER

    As I said before, this will cope with up to 14 rest days (in any number of days) - do you have people with more than 14 rest days in one month?

    See attached
    Attached Files Attached Files

  34. #34
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    I will use the formula for rest days ,annual leaves,sick leaves,...etc.So I want a good formula .
    Phuocam's formula is very good and easy but It depends on a helping cell.
    Can you make the formula independant ?

  35. #35
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    Up.......up........up

  36. #36
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    Up............up............up

  37. #37
    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,101

    Re: formula to write the dates of rest days for every employee in one cell

    I am sure that this will be rejected by you... along with every other suggestion that has been made so far.

    It is as long as it needs to be. Not a character longer. Not a character shorter. It is DLLs array formula from a couple of posts earlier adapted to cope with 31 rest days in a month.

    Use it or ignore it. It's up to you. When you do reject it, it might be nice to get an answer to my Qs back at Post 25, which you have, so far, chosen to ignore.
    Attached Files Attached Files

  38. #38
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    Quote Originally Posted by Phuocam View Post
    =IFERROR(IF($AE$1=1,INDEX($B$2:$AC$2,MATCH("R",B3:AC3,0)),AE3&IF($AE$1>COUNTIF(B3:AC3,"R"),"",
    "+"&INDEX($B$2:$AC$2,SMALL(INDEX(IF(B3:AC3="R",COLUMN($B$2:$AC$2)-1),0),$AE$1)))),"")
    Well done,thank you very much

  39. #39
    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
    81,256

    Re: formula to write the dates of rest days for every employee in one cell

    It would have been nice to at least acknowledge the others who have tried to help you in this thread. I think that some of them are unlikely to help you again, as you have completely ignored their contributions here.
    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.

  40. #40
    Forum Contributor
    Join Date
    02-24-2015
    Location
    Egypt
    MS-Off Ver
    Office 365 ProPlus
    Posts
    769

    Re: formula to write the dates of rest days for every employee in one cell

    I wanted to make a small change for this formula but no one helped me

  41. #41
    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,101

    Re: formula to write the dates of rest days for every employee in one cell

    Yep. He's on my "Ignore" list, for sure. I was playing with DLL's solution - to understand it and to learn to change/adapt it. I hadn't intended to post it; but when I saw the OP's second bump... I couldn't resist the temptation.

    FINALLY, the OP is happy - with a solution rejected a few days ago - and WILL accept one, solo, solitary, lonely, individual helper cell.

    Great!! Well done Phuocam. Have some rep!!

  42. #42
    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
    81,256

    Re: formula to write the dates of rest days for every employee in one cell

    Quote Originally Posted by leprince2007 View Post
    I wanted to make a small change for this formula but no one helped me
    Well, they did, but you ignored them.

+ 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: 10
    Last Post: 02-19-2019, 03:28 AM
  2. Write rest days for all year
    By leprince2007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2017, 03:33 PM
  3. Replies: 4
    Last Post: 01-29-2014, 05:34 PM
  4. Rest of the days
    By Rashidul in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-25-2013, 10:00 PM
  5. Employee Time Tracking - Sick days & Consecutive Days
    By notaguru6 in forum Excel General
    Replies: 6
    Last Post: 08-09-2013, 12:50 PM
  6. Replies: 2
    Last Post: 05-02-2012, 06:22 AM
  7. Macro : To find word and Select rest after this cell and delete rest
    By Zortabello in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2010, 08:06 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