+ Reply to Thread
Results 1 to 6 of 6

Adding New rows with date based on cell values

  1. #1
    Registered User
    Join Date
    07-17-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    6

    Adding New rows with date based on cell values

    Hi,

    Trying to figure our how to add new rows to the bottom of the sheet, with the date and a description based on each cell being marked with a value of 1, A or S.

    I've included an example worksheet any advice would be warmly welcome if this can be done without vba then even better.
    Attached Files Attached Files

  2. #2
    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
    43,986

    Re: Adding New rows with date based on cell values

    There may well be an easier way to do this - but I couldn't think of one!!

    1. dates in December were incorrect: 1/1.2017 changed to 1/1/2017.

    2. Can't use 1.0 for Booked-Off days. can you use B instead?

    To return the dates:
    =IFERROR(1/(1/INDIRECT(TEXT(SMALL(IF(($B$2:$AO$25<>"")*(ISTEXT($B$2:$AO$25)),(ROW($2:$25)-1)*100+COLUMN($B:$AO),10^10),ROWS($1:1)),"R0C00"),)),"")

    To return the absence types:
    =IFERROR(LOOKUP(INDIRECT(TEXT(SMALL(IF(($B$2:$AO$25<>"")*(ISTEXT($B$2:$AO$25)),(ROW($2:$25))*100+COLUMN($B:$AO),10^10),ROWS($1:1)),"R0C00"),),{"A","B","S"},{"Absent","Booked Off","Sick"}),"")

    Both of these are array formulae.

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    07-17-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    6

    Re: Adding New rows with date based on cell values

    You are a star, the b works just as good for my needs.

  4. #4
    Forum Contributor
    Join Date
    03-22-2017
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    230

    Re: Adding New rows with date based on cell values

    Hi Glenn,

    I impress on and enlighten from your formula, I try to use index but fail in the column section as number of column cannot arrange by small function.
    but I not understand the reason why need to have the (1/(1/ in the formula (highlight red in below) as it already have the result from the indirect.

    =IFERROR(1/(1/INDIRECT(TEXT(SMALL(IF(($B$2:$AO$25<>"")*(ISTEXT($B$2:$AO$25)),(ROW($2:$25)-1)*100+COLUMN($B:$AO),10^10),ROWS($1:1)),"R0C00"),)),"")

    thank you,
    Hope you can learn every time you visit here.

    If you still confuse on how it work, kindly ask or go to
    i) Formula - Formula (Ribbon) > Formula Auditing (Section) > Evaluate Formula > Evaluate; or
    ii) VBA/Code - Click F8 to see how it work step by step.

    It it take care of your question, Please:
    Mark tread as [Solved] [Thread Tools->Mark thread as Solved]
    ;and
    Click *Add Reputation to thank anyone solved your question.

  5. #5
    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
    43,986

    Re: Adding New rows with date based on cell values

    Hyraxx. You're welcome...

    Boredworker. I had tried INDEX SMALL as well, and also some SUMPRODUCT combos, but I couldn't quite get it right.. In the absence of the eror trap, the formula returns zeros when it runs out of values. 1/(1/formula) returns the original number in all cases, except for zero, when it returns an error (#/DIV0). the IFERROR mops that up.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  6. #6
    Forum Contributor
    Join Date
    03-22-2017
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    230

    Re: Adding New rows with date based on cell values

    I understood.

    It change the 0 amount to an error (#DIV/0!).

    Thank you.

+ 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: 8
    Last Post: 04-28-2014, 01:51 AM
  2. [SOLVED] Adding rows based if cell value is 1 or 0
    By hbuzz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-19-2014, 09:45 AM
  3. [SOLVED] Adding Rows Based on Cell Value
    By KevinTM in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2013, 11:12 AM
  4. Replies: 4
    Last Post: 06-28-2012, 07:08 AM
  5. [SOLVED] Adding values based on Date
    By troyakaTB in forum Excel General
    Replies: 2
    Last Post: 04-27-2012, 12:53 PM
  6. Adding values based on a date and keyword
    By Jazmania in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-20-2010, 04:15 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