Writing formula

Sunny

New Member
Joined
Apr 10, 2002
Messages
3
My work requires me to write a formula for attendance, but I couldn't write it right. Anyone can help ASAP?


Here is the situation:
I want to calculate an employee's attendance between 1730(means5:30pm) and 1830(means 6:30pm). If one shows up before 1730(5:30pm) or after 1830(6:30pm), (means he doesn't shows up in between 1730 and 1830) then I want the answer to be 0.

Here is the formula I write:
IF(1830>A4>1730, A4-1730,0)

A4 is the column of an employee's show up time.

Logically, if his show-up time is 1720(means 5:20pm), the answer of my formula should be 0.

However, when I filled in 1720 in A4 column, the answer was -10, not 0!

Why? What's the right way to write this formula?

Your kindly help is appreciated!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
On 2002-04-11 01:48, Sunny wrote:
My work requires me to write a formula for attendance, but I couldn't write it right. Anyone can help ASAP?


Here is the situation:
I want to calculate an employee's attendance between 1730(means5:30pm) and 1830(means 6:30pm). If one shows up before 1730(5:30pm) or after 1830(6:30pm), (means he doesn't shows up in between 1730 and 1830) then I want the answer to be 0.

Here is the formula I write:
IF(1830>A4>1730, A4-1730,0)

A4 is the column of an employee's show up time.

Logically, if his show-up time is 1720(means 5:20pm), the answer of my formula should be 0.

However, when I filled in 1720 in A4 column, the answer was -10, not 0!

Why? What's the right way to write this formula?

Your kindly help is appreciated!

=(A4>=1730)*(A4<=1830)

or

=IF(AND(A4>=1730,A4<=1830),1,0)

These formulas are equivalent. They produce 1 if show up time is between 1730 and 1830 inclusive, otherwise 0.
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top