+ Reply to Thread
Results 1 to 16 of 16

Add 1 to all greater values based on criteria

  1. #1
    Forum Contributor
    Join Date
    07-19-2022
    Location
    Cairo, Egypt
    MS-Off Ver
    Office 365
    Posts
    128

    Question Add 1 to all greater values based on criteria

    Hello Dears,

    In the attached sheet you'll find trips associated with blocks and I need to associate the trips to the next block if there is a Driver insertion.

    You'll find that there is 3 Drivers insertion in each Direction, I need to tell Excel that when you find "1" in Driver insertion start associating all next trips in the same direction w to the next block.

    and when you find "2" in Driver insertion, start associating all next trips with In-S = 1 to the previous block.
    Attached Files Attached Files

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

    Re: Add 1 to all greater values based on criteria

    I sincerely hope this isn't going to impact on the hours of work I have put into your other thread!

    You need to add some expected results.
    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.

  3. #3
    Forum Contributor
    Join Date
    07-19-2022
    Location
    Cairo, Egypt
    MS-Off Ver
    Office 365
    Posts
    128

    Question Re: Add 1 to all greater values based on criteria

    Of course not, it's another thing related to the Drivers.

    You'll be the best to understand what I mean, the concept here is if there are 1 Driver will Drive the block for all the day then the Driver cycle should be the same as the Vehicle cycle... but it's not the case because these block cycles is performed over +18 hrs each day which means there are more than 1 Driver doing them.

    Well, I'm attaching an example for what is expected.

    If we managed to say to the excel, whenever you find 1 in Driver Insertion then associate this trip and all the next trips in this Direction to the next block... then will apply your previous formula to get the desired Driver cycle view.
    Attached Files Attached Files
    Last edited by Hesham121; 05-21-2023 at 02:44 AM.

  4. #4
    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,455

    Re: Add 1 to all greater values based on criteria

    Well, you have presented a workbook with MY formula under the heading "What I managed to do" - I think it would have been nice to credit me with the work I have put in so far since it was I who managed to do it!!!

    I will see if I can work this one out next.

    EDIT: Thank you for now having credited me in the workbook. It is appreciated, as this was a real slog.
    Last edited by AliGW; 05-21-2023 at 02:45 AM.

  5. #5
    Forum Contributor
    Join Date
    07-19-2022
    Location
    Cairo, Egypt
    MS-Off Ver
    Office 365
    Posts
    128

    Re: Add 1 to all greater values based on criteria

    So sorry for this mistake, I've just downloaded your file and didn't notice this cell... I've edited my post and added a new file.

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

    Re: Add 1 to all greater values based on criteria

    Thank you. However, I am going to let someone else have a go. I really don't have the time to work out your logic on this one, let alone find a formula, but for the benefit of anyone who does, please explain in WORDS the exact logic of the first THREE entries in the new driver column. Explain EXACTLY how you have decided to place 1 or 2 in those cells, why those particular rows, etc. You need to be much more scientific in your explanation - it took me a long time yesterday to get my head around your logic, as you hadn't really explained it very clearly.

    There's not enough guidance from you here so far for anyone to make a start.

    Good luck!

  7. #7
    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,455

    Re: Add 1 to all greater values based on criteria

    Just having a look at this and there is a lot of explanation needed. In block 1, where do the numbers come from? Because I cannot find most of them in block 1 at all (141 for example)

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    Y
    8
    DTABA
    9
    103
    10
    108
    11
    141
    12
    152
    13
    185
    14
    196
    15
    229
    16
    240
    17
    275
    18
    286
    19
    325
    20
    336
    21
    375
    22
    386
    23
    425
    24
    436
    25
    469
    26
    470
    27
    DTSLM
    Sheet: Cycles

  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,455

    Re: Add 1 to all greater values based on criteria

    If you want help with this, you will need to explain clearly and logically how these trips end up in the driver blocks in the right-most column.

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    2
    Block
    Trip
    From
    To
    Start
    End
    Direction
    In-S
    Driver Insertion
    Driver
    Block
    4
    1
    103
    ABA3
    KIT2
    5:26:00
    5:41:46
    1
    1
    1
    5
    1
    108
    KIT2
    ADM2
    5:48:00
    6:34:27
    2
    1
    1
    8
    1
    133
    ADM1
    KIT2
    6:47:21
    7:34:37
    1
    1
    1
    22
    9
    1
    138
    KIT2
    ADM2
    7:38:15
    8:24:42
    2
    1
    19
    12
    1
    165
    ADM1
    KIT2
    8:31:21
    9:18:37
    1
    1
    16
    13
    1
    170
    KIT2
    ADM2
    9:22:15
    10:08:42
    2
    1
    12
    16
    1
    197
    ADM1
    KIT2
    10:15:21
    11:02:37
    1
    1
    8
    17
    1
    202
    KIT2
    ADM2
    11:06:15
    11:52:42
    2
    1
    5
    20
    1
    229
    ADM1
    KIT2
    11:59:21
    12:46:37
    1
    1
    1
    21
    1
    234
    KIT2
    ADM2
    12:50:15
    13:36:42
    2
    1
    23
    24
    1
    263
    ADM1
    KIT2
    13:48:21
    14:35:37
    1
    1
    20
    25
    1
    268
    KIT2
    ADM2
    14:38:15
    15:24:42
    2
    1
    17
    28
    1
    301
    ADM1
    KIT2
    15:34:21
    16:21:37
    1
    1
    14
    29
    1
    306
    KIT2
    ADM2
    16:24:15
    17:10:42
    2
    1
    11
    32
    1
    339
    ADM1
    KIT2
    17:18:51
    18:06:07
    1
    1
    8
    33
    1
    344
    KIT2
    ADM2
    18:08:45
    18:55:12
    2
    1
    5
    36
    1
    377
    ADM1
    KIT2
    19:03:21
    19:50:37
    1
    1
    2
    37
    1
    382
    KIT2
    ADM2
    19:53:15
    20:39:42
    2
    1
    24
    40
    1
    415
    ADM1
    KIT2
    20:47:51
    21:35:07
    1
    1
    21
    41
    1
    420
    KIT2
    ADM2
    21:37:45
    22:24:12
    2
    1
    18
    44
    1
    453
    ADM1
    KIT2
    22:32:21
    23:19:37
    1
    1
    15
    45
    1
    458
    KIT2
    ADM2
    23:22:15
    24:08:42
    2
    1
    15
    48
    1
    485
    ADM1
    KIT2
    24:17:51
    25:05:07
    1
    1
    15
    Sheet: Trips

    Phrases like this:

    If we managed to say to the excel, whenever you find 1 in Driver Insertion then associate this trip and all the next trips in this Direction to the next block... then will apply your previous formula to get the desired Driver cycle view.
    are not scientific enough for anyone to divine a logical rule from them. We need a much more rigorous explanation of how you have assigned trips to the driver blocks you have shown them in.

  9. #9
    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,455

    Re: Add 1 to all greater values based on criteria

    When you come up with an explanation, please make it concrete with specific examples and not conceptual.

  10. #10
    Forum Contributor
    Join Date
    07-19-2022
    Location
    Cairo, Egypt
    MS-Off Ver
    Office 365
    Posts
    128

    Re: Add 1 to all greater values based on criteria

    Hi Ali,

    I've tried to explain the logic behind the Drivers' Cycles Designing in the attached file, Please check and tell me if there's anything not clear to explain further details.

    Thanks in advance
    Attached Files Attached Files

  11. #11
    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,455

    Re: Add 1 to all greater values based on criteria

    I doubt this is doable. The fact that you decide where to insert extra drivers suggests that there is no specific logic to that choice.

    Is there a logic to it?

  12. #12
    Forum Contributor
    Join Date
    07-19-2022
    Location
    Cairo, Egypt
    MS-Off Ver
    Office 365
    Posts
    128

    Re: Add 1 to all greater values based on criteria

    Quote Originally Posted by AliGW View Post
    I doubt this is doable. The fact that you decide where to insert extra drivers suggests that there is no specific logic to that choice.

    Is there a logic to it?
    Yes, we're choosing to insert Drivers considering many factors like the starting trip time, In the attached example we've chosen to insert a Driver for the Morning shift which is starting @ 6:30 AM, and morning shifts aren't responsible for pull-out trains from the garage.

    I thought about the OFFSET function, but I wasn't able to develop a complicated formula to get the expected results.

  13. #13
    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,455

    Re: Add 1 to all greater values based on criteria

    It's not as simple as that: Excel would need to understand the logic that you were using to be able to replicate the decisions you were making, and there would be far too many variables for a formula to cope with. This is verging on an AI requirement!

    It can't be done. Sorry. This one's going to have to remain a manual process, I'm afraid.

  14. #14
    Forum Contributor
    Join Date
    07-19-2022
    Location
    Cairo, Egypt
    MS-Off Ver
    Office 365
    Posts
    128

    Re: Add 1 to all greater values based on criteria

    Got your point.

    Thanks for explaining it

  15. #15
    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,455

    Re: Add 1 to all greater values based on criteria

    I'm sorry. At least we got the train trips sorted!

  16. #16
    Forum Contributor
    Join Date
    07-19-2022
    Location
    Cairo, Egypt
    MS-Off Ver
    Office 365
    Posts
    128

    Re: Add 1 to all greater values based on criteria

    Of course, it was a great achievement... Thanks to your genius solution!

+ 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. [SOLVED] Count dates greater than today based on other date criteria
    By moneypennie21 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-21-2022, 10:44 AM
  2. Replies: 2
    Last Post: 07-26-2020, 06:37 AM
  3. [SOLVED] cell values show extra column in pivot table greater than criteria ">100000"
    By majidsiddique in forum Excel General
    Replies: 7
    Last Post: 07-17-2019, 05:06 AM
  4. Replies: 3
    Last Post: 04-21-2017, 05:32 PM
  5. VBA Macro Dividing Values Based upon Matching Criteria and Description Criteria
    By pvsvprasad in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 09-18-2016, 12:39 PM
  6. [SOLVED] Copy rows from multiple worksheets with multiple criteria - greater than dynamic values
    By stackout in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-03-2015, 04:36 PM
  7. [SOLVED] count values greater 2 or greater in a column.
    By ammartino44 in forum Excel General
    Replies: 3
    Last Post: 09-16-2014, 07:05 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