473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Excel 2000, IF function with multiple condition

48
I am using Excel 2000 to calculate the pay for worker and there are 4 possibility:
1.If actual work time is within 5 minutes under rostered time, pay rostered time
2.If actual work time is 5 minutes more under rostered time, pay actual work time
3.If actual work time is within 5 minutes over rostered time, pay actual work time
4.If actual work time is 5 minutes more than rostered time, pay rostered time plus 5 minutes.

For example:
Case1:
Rostered Time: 1.50 (1 hour 30 minutes convert to decimal =1.50)
Actual work time: 1.47 ( 1 hour 28 minutes)
Pay: 1.50

Case2:
Rostered Time: 1.50
Actual Work time: 1.37 (1 hour 22 minutes)
Pay:1.37

Case3:
Rostered Time: 1.50
Actual Work Time: 1.56 (1 hour 34 minutes)
Pay: 1.56

Case4:
Rostered Time:1.50
Actual Work Time: 1.60 (1 hour 37 minutes)
Pay: 1.58


Note that the rostered hour is not always 1.5. It can be 1, or 2, or 0.25 or 0.50, or 0.75 depend on different service.

The formula below only works when the actual work time is 5 minutes over than rostered time:
K2=Actual Work time, L2=Rostered Time
=IF($K2-$L2>=0.08,$L2+0.08,IF($L2-$K2<=0.08,$L2,$K2))


The formula below won't pay up to rostered time if the actual work less than rostered time:
=IF((K59-L59<=0.08),K59,IF((K59-L59>0.08),L59+0.08,IF((L59-K59<=0.08),L59,IF((L59-K59>0.08),K59,""))))

Can anyone correct the formula for me please? or suggest a different formula altogether? Appreciate it.
Sep 8 '08 #1
3 1457
asedt
125 100+
=IF((K59-L59<=0.08),K59,IF((K59-L59>0.08),L59+0.08,IF((L59-K59<=0.08),L59,IF((L59-K59>0.08),K59,""))))
Do people really write things like that.. (http://personal-computer-tutor.com/if2.htm ho shit maybe the do) you can at least add some indentation so it's readable. Use if-else /select case instead?

Expand|Select|Wrap|Line Numbers
  1. =IF((K59-L59<=0.08),
  2.     K59,
  3.  
  4.     IF((K59-L59>0.08),
  5.         L59+0.08,
  6.  
  7.         IF((L59-K59<=0.08),
  8.             L59,
  9.  
  10.             IF((L59-K59>0.08),
  11.                 K59,
  12.                 ""))))
  13.  
  14.  
My code:

Expand|Select|Wrap|Line Numbers
  1. if AW > RT then
  2.      if AW > RT + 0.08 then
  3.           RT + 0.08
  4.      else
  5.           AW
  6.      end if
  7. else
  8.      if AW > RT - 0.08 then
  9.           RT
  10.      else
  11.           AW
  12.      end if
  13. end if
  14.  
I hope you can run that and that it works like you whished.
Sep 8 '08 #2
HowHow
48
Thanks for the link, I've got it:

Consider L is Rostered Time and K is Actual Work.

Case 1:
Paying rostered time if actual work is within 5 minutes under roster.
Paying actual working time if actual work is more than 5 minutes under roster. Paying up to rostered time if actual work is more than roster:

Expand|Select|Wrap|Line Numbers
  1. =IF($K2-$L2>=0,$L2,IF($L2-$K2<=0.08,$L2,$K2))
Case 2:
Paying rostered time if actual work is within 5 minutes under roster.
Paying actual working time if actual work is more than 5 minutes under roster.
Paying up to 3 minutes if actual work is more than rostered time:

Expand|Select|Wrap|Line Numbers
  1. =IF((AND($L2-$K2<0,$L2-$K2>=-0.05)),$K2,IF((AND($L2-$K2>=0,$L2-$K2<=0.08)),$L2,IF(($L2-$K2<-0.05),$L2+0.05,IF(($L2-$K2>0.08),$K2,""))))
Case 3:
All the same as above but paying up to 5 minutes if actual work is over the rostered time:

Expand|Select|Wrap|Line Numbers
  1. =IF((AND($L2-$K2<0,$L2-$K2>=-0.08)),$K2,IF((AND($L2-$K2>=0,$L2-$K2<=0.08)),$L2,IF(($L2-$K2<-0.08),$L2+0.08,IF(($L2-$K2>0.08),$K2,""))))
Sep 9 '08 #3
asedt
125 100+

Case 3:
All the same as above but paying up to 5 minutes if actual work is over the rostered time:

Expand|Select|Wrap|Line Numbers
  1. =IF((AND($L2-$K2<0,$L2-$K2>=-0.08)),$K2,IF((AND($L2-$K2>=0,$L2-$K2<=0.08)),$L2,IF(($L2-$K2<-0.08),$L2+0.08,IF(($L2-$K2>0.08),$K2,""))))

Did you not get the last part:

A = AW, B = RT, 2 = limit ower and under RT

My code once agen:

Expand|Select|Wrap|Line Numbers
  1. =IF((A2>B2);IF((A2>B2+2);B2+2;A2);IF((A2>B2-2);B2;A2))
  2.  
Gives:
Expand|Select|Wrap|Line Numbers
  1. AW    RT    
  2. 21,0    25    21
  3. 21,5    25    21,5
  4. 22,0    25    22
  5. 22,5    25    22,5
  6. 23,0    25    23
  7. 23,5    25    25
  8. 24,0    25    25
  9. 24,5    25    25
  10. 25,0    25    25
  11. 25,5    25    25,5
  12. 26,0    25    26
  13. 26,5    25    26,5
  14. 27,0    25    27
  15. 27,5    25    27
  16. 28,0    25    27
  17. 28,5    25    27
  18.  
In Excel 2003, but 2000 can't be that different.
Sep 9 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Indra | last post by:
Hi There, I am looking for information on how to import the txt or csv file to the multiple table in sql 2000. If you have any kind of inf. please let me know wheather we can do this and how. ...
3
by: Nick Carter | last post by:
I am automating Excel 2000 using the COM interop. I have noticed that the application doesn't run with Excel 97. I want to write just one piece of code which will work with both Excel 2000 and...
11
by: Mr. Smith | last post by:
Hello all, My code can successfully open, write to, format and save several worksheets in a workbook then save it by a given name, close and quit excel. My problem is that if I try and do it...
1
by: (Pete Cresswell) | last post by:
I'm debugging an app that has a Reference to Excel 9.0 (i.e. Office 2000's Excel). A guy who is trying to test it for me has Office 2003 (Excel 10? Excel 11?) installed on his PC and the most...
17
by: Mansi | last post by:
I need to do some research on how to use excel automation from c#. Does anyone know of any good books related to this subject? Thanks. Mansi
11
by: BrianDH | last post by:
Hi Is there a way, in VB.Net, to write a windows based program that will use more than one version of Office (Excel)? Example: if office 2000 then else if office 2003 then. Is this possible? ...
3
by: Michael Kellogg | last post by:
My application works with Excel to put together spreadsheets for reporting purposes. It runs just fine on my box, but when I put it on another one, it bombs. Here is the relevant code: ...
21
by: bobh | last post by:
Hi All, In Access97 I have a table that's greater than 65k records and I'm looking for a VBA way to export the records to Excel. Anyone have vba code to export from access to excel and have the...
1
by: BLavanya | last post by:
I want to Open an excel sheet , then I want to loop through the rows in the excel sheet and should execute an update query for all the rows where the where condition in the query should match the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.