+ Reply to Thread
Results 1 to 6 of 6

reset when start new element in column

  1. #1
    Registered User
    Join Date
    06-26-2016
    Location
    Barcelona
    MS-Off Ver
    Office 2007
    Posts
    21

    reset when start new element in column

    I'm trying to count the difference of dates reseting for each new user:

    Please Login or Register  to view this content.
    In the above example I have the userid and Date columns and have to create the Days column as the difference of the first day with each of the following days for each userid, so I have to reset the difference when the userid changes therefore I need to take as first day the one that corresponds to the new user as in the example
    Attached Files Attached Files
    Last edited by anahochmanova; 09-07-2017 at 04:18 AM.

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

    Re: reset when start new element in column

    NON VBA solution

    C2 =IF(A2<>A1,0,$B2-INDEX($A$2:$B$41,MATCH($A2;$A$1:$A$41,0),2)) and drag down

    Attachment added.
    Last edited by oeldere; 09-06-2017 at 11:06 AM. Reason: atachement added
    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.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: reset when start new element in column

    Hi ana,

    If you had 2016 Excel which has a new function called MinIFS you would put in C2 this formula:

    =B2-MINIFS(B:B,A:A,A2)

    and pull it down for the whole column.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: reset when start new element in column

    There is also an Array answer for this problem.

    =B2-MIN(IF($A$1:$A$41=A2,$B$1:$B$41,""))

    You need to enter the above in C2 and then enter it using a Control+Shift+Enter (CSE) keystroke combination.
    You will see "{ }" around your formula if done correctly.

    CSE Days since minimum by ID.xlsx

    You could also enter this CSE formula:
    =B2-MIN(IF(A:A=A2,B:B,""))

    which will allow you to enter more rows and it will calculate correctly but take longer.
    Last edited by MarvinP; 09-06-2017 at 11:26 AM.

  5. #5
    Registered User
    Join Date
    06-26-2016
    Location
    Barcelona
    MS-Off Ver
    Office 2007
    Posts
    21

    Re: reset when start new element in column

    Quote Originally Posted by oeldere View Post
    NON VBA solution

    C2 =IF(A2<>A1,0,$B2-INDEX($A$2:$B$41,MATCH($A2;$A$1:$A$41,0),2)) and drag down

    Attachment added.
    THANKS A LOT!! Works great!!

  6. #6
    Registered User
    Join Date
    06-26-2016
    Location
    Barcelona
    MS-Off Ver
    Office 2007
    Posts
    21

    Re: reset when start new element in column

    Quote Originally Posted by MarvinP View Post
    There is also an Array answer for this problem.

    =B2-MIN(IF($A$1:$A$41=A2,$B$1:$B$41,""))

    You need to enter the above in C2 and then enter it using a Control+Shift+Enter (CSE) keystroke combination.
    You will see "{ }" around your formula if done correctly.

    Attachment 536847

    You could also enter this CSE formula:
    =B2-MIN(IF(A:A=A2,B:B,""))

    which will allow you to enter more rows and it will calculate correctly but take longer.
    THANKS! I added reputation

+ 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: 2
    Last Post: 04-25-2017, 09:11 AM
  2. Six 30 minute fixed countdown timers with start, stop and reset buttons.
    By Marty62 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-18-2014, 07:31 AM
  3. Replies: 2
    Last Post: 12-18-2014, 02:33 AM
  4. [SOLVED] Ctr Key + ? to reset excel sheet to start
    By bnwash in forum Excel General
    Replies: 9
    Last Post: 12-10-2014, 07:40 AM
  5. to update stop watch in excel with start/pause and reset options.
    By harry_appu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-25-2013, 01:42 PM
  6. multiple cell with perdetermined 15min countdown with start and reset button
    By rexyang08 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2013, 01:43 PM
  7. Reset an Array to start over
    By hotherps in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2005, 08:36 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