I am trying to make forms that employee less complicated as passable so they do not have to type in as much information. I am trying to make a formula that will take the hour of the day and return ether a 1 or a 2 that represents what shift it is according to the current time of day. Ex if hour = 19-6 then s =1 if hour = 7-18 then s = 2
THE NOW() Function is volatile so any formulas based on it will change automatically, is that what you want?
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
PL try this formula in the required cell
=IF(OR(NOW()<=TIME(6,0,0),NOW()>=TIME(19,0,0)),1,IF(AND(NOW()<=TIME(18,0,0),NOW()>=TIME(7,0,0)),2,"" ))
Think you kvsrinivasamurthy but no matter what time I change the computer time to in bois and start menu time it will only bring up a 1. I trayed to modify yours with: IF(((NOW()<=TIME(6,0,0)),AND(NOW()>=TIME(19,0,0))),1,OR((NOW()<=TIME(18,0,0)),AND(NOW()>=TIME(7,0,0) )),2,) but it does not work either
NOW is both Day (integer) and Time (decimal) not just Time hence NOW() will always exceed 19:00 (unless date is set as day 0 in BIOS!)
=1+AND(MOD(NOW(),1)>=TIME(7,0,0),MOD(NOW(),1)<=TIME(18,0,0))
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Pl replace the formula like this.Remember that only when change happens in workd\sheet this will change.
=IF(OR(MOD(NOW(),1)<=TIME(6,0,0),MOD(NOW(),1)>=TIME(19,0,0)),1,IF(AND(MOD(NOW(),1)<=TIME(18,0,0),MOD (NOW(),1)>=TIME(7,0,0)),2,"" ))
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks