# Software

## General discussion

Locked

### Excel Formula

By ·
Excel Formula not working...
I hope this is where I post this question?

I have a MASSIVE formula that I using to accrue vacation time based on different criteria. Basically I am wanting to use the same formula that I'm using now, just add something to it. I can not get it to work however.

My problem- I need to execute a formula for an employee only IF the employee has worked 140 hours for the month. I can download the employee's hours from an ODBC so that is no problem. My issue is how do I say in the formula- =IF (A3 >= 140)THEN,

massive formula:
--------------------------------------------------=IF(AND(DAY(TODAY())>=DAY(A3),YEAR(TODAY())=YEAR(A3)),(MONTH(TODAY())-MONTH(A3))*3.34,IF(AND(DAY(TODAY())<DAY(A3),YEAR(TODAY())=YEAR(A3)),(MONTH(TODAY())-(MONTH(A3)+1))*3.34,IF(AND(YEAR(TODAY() >YEAR(A3)),(YEAR(TODAY())-YEAR(A3)<10),DAY(TODAY())>=DAY(A3)),(((MONTH(TODAY()))*(80/12))+((12-MONTH(A3))*3.34)+((YEAR(TODAY())-(YEAR(A3)+1))*80)),IF(AND(YEAR(TODAY()>YEAR(A3)),(YEAR(TODAY())-YEAR(A3)<10),DAY(TODAY())<DAY(A3)),(((MO NTH(TODAY())-1)*(80/12))+((12-MONTH(A3))*3.34)+((YEAR(TODAY())-(YEAR(A3)+1))*80)),"N/A"))))
--------------------------------------------------

THANKS for any help on this!!!

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)
Thread display: Collapse - | Expand +

Collapse -
by In reply to Excel Formula

=IF (A3 >= 140,IF(AND(DAY(TODAY())>=DAY(A3),YEAR(TODAY())=YEAR(A3)),(MONTH(TODAY())-MONTH(A3))*3.34,IF(AND(DAY(TODAY())<DAY(A3),YEAR(TODAY())=YEAR(A3)),(MONTH(TODAY())-(MONTH(A3)+1))*3.34,IF(AND(YEAR(TODAY() >YEAR(A3)),(YEAR(TODAY())-YEAR(A3)<10),DAY(TODAY())>=DAY(A3)),(((MONTH(TODAY()))*(80/12))+((12-MONTH(A3))*3.34)+((YEAR(TODAY())-(YEAR(A3)+1))*80)),IF(AND(YEAR(TODAY()>YEAR(A3)),(YEAR(TODAY())-YEAR(A3)<10),DAY(TODAY())<DAY(A3)),(((M O NTH(TODAY())-1)*(80/12))+((12-MONTH(A3))*3.34)+((YEAR(TODAY())-(YEAR(A3)+1))*80)),"N/A")))),"")

Collapse -
by In reply to Excel Formula

Thanks! Yet now my massive formula isn't working. Instead of getting their actual accrued hours, I'm getting all "N/A"'s. Maybe this will help- This formula is for employees who have worked 1 month-9 yrs. So the formula is based off of hire date and then accrued at 3.34hrs per month. The most anyone can have though is 40 hrs.(actually 40.08=3.34*12) But I only need the formula to run if they have worked at least 140 hours the prior month. I download the prior months hours worked from an ODBC source so I don't have to actually figure this up thank goodness!

I hope this makes sense?

Collapse -
by In reply to Excel Formula

Your cell should separate the date hours rendered in prev month and the date hired. In your example, your cell is only a3. So assuming you have cell a3 as hours rendered and cell a4 as
date hired the formula (you need to install analysis toolpack in your addin for this formula to work)
=IF(A3>=140,MIN(3.34*12,DATEDIF(A4,A9,"m"))*3.34,"n/a")

Collapse -
by In reply to Excel Formula

To make the logic more readable create a function and passparameters to it. This way it can be more structured and easy to maintain.

Back to Software Forum
4 total posts (Page 1 of 1)

## Related Discussions

• 1

#### Worst technology company to work for are the ones where developers are not

rams1582457778 ·

• 2

#### Is there an alternative to Brightcove & Vplayed for creating VOD platform?

charlieleo34 ·

• 9

#### What CRM software do you use?

ninapavljukpipa ·

• 0

#### Wireshark - To "Analyze TCP sequence numbers" or not to analyze

ejeangilles ·

• 0

#### Import data frrom tik tok

cristicaruntu ·