+ Reply to Thread
Results 1 to 29 of 29

Combine MOD and INT formulas

Hybrid View

  1. #1
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Combine MOD and INT formulas

    Hi all!
    Here I have a formula:

    =IF(AND(E4<>"",X25<>"",Q25<>"",S25<>""),INT(E4+X25-Q25-S25)&" Days "&TEXT(E4+X25-Q25-S25,"h:mm"),"")

    But I need to combine it with MOD function. How?
    Thanks!

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Combine MOD and INT formulas

    I am assuming you need the MOD function to get the time?

    e.g

    =IF(AND(E4<>"",X25<>"",Q25<>"",S25<>""),INT(E4+X25-Q25-S25)&" Days "&TEXT(MOD(E4+X25-Q25-S25,1),"h:mm"),"")
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    Follow the link. This is thread about my problem.
    http://www.excelforum.com/excel-gene...t-7-00-am.html

  4. #4
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    It shows negatives to me

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Combine MOD and INT formulas

    examples of what you have and what you want would be nice.

  6. #6
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    Here you are.. I`ve built you an example what I need. Thanks a lot!

  7. #7
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    Forgot attachment... Sorry...
    Attached Files Attached Files

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Combine MOD and INT formulas

    I still don't understand what the formula you want is for?

    What would also be the result you expect with your sample and why?

  9. #9
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    Task started:
    05-May 22:00
    Task finished:
    05-May 02:00
    The result I want - 4 hrs

    Task started:
    05-May 05:00
    Task finished:
    06-May 08:00
    The result I want - 3 hrs.

    Just where am I working, date changes not at midnight, but at 7:00 am.

  10. #10
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Combine MOD and INT formulas

    =IF(AND(E4<>"",X25<>"",Q25<>"",S25<>""),TEXT(E4+X25-Q25-S25,"dd /da/y/s h:mm"),"")
    /d /y /s are there because dys are formatting commands, the / tells the format to take it as a character!
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


  11. #11
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Combine MOD and INT formulas

    Try this
    It worked for me

    Start Date   	End Date	         Result	Formulae
    05 May 2010 22:00	05 May 2010 02:00	4:00	="24:00"-MOD(A2,1)+MOD(B2,1)
    05 May 2010 05:00	06 May 2010 08:00	3:00	="24:00"-MOD(A3,1)+MOD(B3,1)
    Attached Files Attached Files
    Last edited by contaminated; 05-28-2010 at 03:35 PM.
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  12. #12
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    Ok. Forget the topic of this thread. Imagine, day starts 7:00 am. Today is 28-May, tomorrow at 7:00 am will be 29-May. So, i have a paperwork in front of me, saying task started 27-May at 23:00 and finished 27-May at 02:00. Actually, task duration is 3 hours. This is the point where MOD function helps me. But when duration is bigger than 24 hours, formula (and formatting) says 0 days and whatever hours. How to make excel think that 24 h day runs 7:00 am to 7:00 am???

  13. #13
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    Sorry, you`ve posted while I typed

  14. #14
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    All right. There is one BUT. My dates and times are in separate cells. In this case what am I suppose to do with this formula?

  15. #15
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Combine MOD and INT formulas

    the best way I think

    Start Date	 Start Time	End Date	  End Time	    Result	    Formula
    05 May 2010	22:00	05 May 2010	2:00	04:00	="24:00"-MOD(A2+B2,1)+MOD(C2+D2,1)
    05 May 2010	5:00	05 Jun 2010	8:00	03:00	="24:00"-MOD(A3+B3,1)+MOD(C3+D3,1)
    More about Date & Times
    Attached Files Attached Files
    Last edited by contaminated; 05-28-2010 at 03:49 PM.

  16. #16
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    It doen`t work for me. It calculates time but not days. There some tasks whitch take 2 days or more. The MOD function does not deal with days. Try to put start date 03-May any time and finish date try 06-May any time. Sure enough, won`t work. How to deal with it?
    .

  17. #17
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Combine MOD and INT formulas

    sorry didn't see post # 12

  18. #18
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Combine MOD and INT formulas

    What the output shild be if
    StartDate is 12 May 2010
    StartTime is 23:00
    EndDtae is 30 May
    EndTime is 03:00

    ?????????

  19. #19
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    It should say 28 hrs

  20. #20
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    Ooops! I have counted as the end date was 13-May. But you asked for 30-May? The maximum duration at my work is up to 4 days.

  21. #21
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Combine MOD and INT formulas

    StartDate is 12 May 2010
    StartTime is 23:00
    EndDtae is 13 May
    EndTime is 03:00

    OUTPUT IS 28
    am I right????

  22. #22
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    Yes. 28 hrs.

  23. #23
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Combine MOD and INT formulas

    Sorry but I need a little bit clarification
    Explain the logic please once agai
    How do you count?

  24. #24
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    I have made an example for you. This should explain you what I really want. Have a look at it.
    Attached Files Attached Files

  25. #25
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Combine MOD and INT formulas

    thanks for clarification
    I'l take a look at this tommorow
    It's 2:41 AM (((

  26. #26
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Combine MOD and INT formulas

    Hi,

    How about this?
    Attached Files Attached Files
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  27. #27
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    No. That easy I can do myself. Have a look whats happening in example 2. See attached...
    Attached Files Attached Files

  28. #28
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,721

    Re: Combine MOD and INT formulas

    Assuming start date in A2, start time in B2, end date in C2 and end time in D2 then you can use this formula to give total hours, e.g. 28:00

    =C2-A2+MOD(D2-"7:00",1)-MOD(B2-"7:00",1)

    format as [h]:mm

    or if you want the result as 1 day(s) 4:00

    then try like this

    =INT(C2-A2-(MOD(B2-"7:00",1)>MOD(D2-"7:00",1)))&" day(s) "&TEXT(1+D2-B2,"h:mm")

  29. #29
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Combine MOD and INT formulas

    Finally... Finally??? Finally!!!
    Thanks a ton folks! Everyone who helped me in the past, and hopefully will help in a future. Thanks!
    It works!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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