+ Reply to Thread
Results 1 to 13 of 13

Modify teh present formula

  1. #1
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Modify teh present formula

    Hello,

    I'd like to have a formula in order to subtract hours take into account 1 condition.
    -If he/she is on duty (the simbol can be: N, N1, N2, N3, N4) in the last day of month then subtract 6.
    I use for calculation this one:
    Col AQ: COUNTIF($C12:$AG12,AQ$11)*AQ$10
    for example, the first guy works 4 nights, I multiply by 8, result 32, now because he works in the last day of month I need to subtract 6 hours, so the result should be 32-6=26.

    Attached a test file for your reference.
    Thank you very much for your help!
    Attached Files Attached Files
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  2. #2
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Modify teh present formula

    Try

    Aq12
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

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

    Re: Modify teh present formula

    Try this ...

    =COUNTIF($C12:$AG12,AQ$11)*AQ$10-IF(LEFT(INDEX(C12:AG12,DAY(EOMONTH($A$10,0))),1)="N",6,0)

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Modify teh present formula

    That's it! Thank you very much for your help!

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Modify teh present formula

    Another way.

    =COUNTIF($C12:$AG12,AQ$11)*AQ$10-ISNUMBER(FIND({"N","N1","N2","N3","N4"},AD12))*6
    Dave

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Modify teh present formula

    Shukla, thank you, but the last day of month can be col AD, AE, AF or AG....

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Modify teh present formula

    In that case change my formula to

    =COUNTIF($C12:$AG12,AQ$11)*AQ$10-ISNUMBER(FIND({"N","N1","N2","N3","N4"},INDEX($C12:$AG12,MATCH("zzzz",$C$11:$AG$11,1))))*6

  8. #8
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Modify teh present formula

    Quote Originally Posted by john55 View Post
    Shukla, thank you, but the last day of month can be col AD, AE, AF or AG....
    Then Try

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by shukla.ankur281190; 02-25-2017 at 04:47 AM. Reason: Its not array argument

  9. #9
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Modify teh present formula

    Shukla, "Ref" ... with the last formula, I tried ctrl+shift+enter but I have Ref in cell..

  10. #10
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Modify teh present formula

    Quote Originally Posted by john55 View Post
    Shukla, "Ref" ... with the last formula, I tried ctrl+shift+enter but I have Ref in cell..
    There is no need to CSE.

    Please check the attached file here it is working great.
    Attached Files Attached Files

  11. #11
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Modify teh present formula

    Flame, it works, I test it for dif dates but it seems it's working!

  12. #12
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Modify teh present formula

    Thanks to all of you!
    That's it!

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Modify teh present formula

    You're welcome. Thanks for the feedback and rep.

+ 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. Excel 2003 formula - modify one cell, another cell track the modify date
    By baby0596cw in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 11-06-2014, 12:55 PM
  2. Replies: 2
    Last Post: 09-03-2014, 03:37 AM
  3. [SOLVED] formula to tell me when someone is present on work, present late and early departure.
    By Shellybelly in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-03-2013, 01:38 AM
  4. Replies: 1
    Last Post: 08-14-2013, 10:41 PM
  5. [SOLVED] Auto Hiding rows based on range/data present or not present.
    By raze in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 02-10-2013, 11:27 AM
  6. Copy For Cell Values Present and not Formulas Present
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2009, 12:10 PM
  7. formula from past day to present day
    By tigertim71 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-29-2008, 03:37 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