IF Formula Dates, Limitations & Lost Vacation

ZSandman

New Member
Joined
Nov 4, 2002
Messages
20
Greetings, new guy here. Hope the following is a clear and adequate explanation. We've been working on a calendar application which tracks days off, sick days, business trips. It's intended to populate an activities listing containing due dates so we can see what's due and who's around to do it. We've run into a wall despite some local wizards having a go and sure hope someone can assist. The problem involves an IF statement which seems to be limited in the number of rows or cells it can handle. We're not committed to the IF statement, but don't know of another way to handle it. Spreadsheet structure:

Col Usage
A Employee Names with the need for 15
blank cells below between each employee.
B First Date out of Office (MM/DD/YY) for
employee in Col A
C Last Date out of Office (MM/DD/YY).
So, for each employee in column A, they
list the days they will be out of the
office in cols B & C with 16 rows for
them to work with.
D Number of Days out of Office (Calen Days)
E Absence Code (S=Sick,V=Vac,T=Trip)
F Company_Holidays (MM/DD/YY) Each day is
listed in this column.
G Days of the Year (Jan 1-Dec 31 MM/DD/YY)
H Employee #1
I Employee #2 (15 rows down or so)
J Employee #3 and so on

Beginning in column H (I, J etc), we want all the cells populated with one of the following for each calendar day in Col G:
1. If it's a non-business day, an "N"
2. If it's a business day, but the employee
is not in, the code shown in Col E.
3. Otherwise blank

We can then count the results of the formula to track days vacation etc.

The problem we're experiencing is that we can't get the formula to accept any more than five rows i.e. pairs of Dates Out of Office (or perhaps it's the corresponding total number of cells in the formula). When we try to add an additional pair of Dates Out of Office e.g. B13, C13, and E13 (for Absence Code) to the following formula, it ceases to work. There seems to be a limit in the structure of the formula. We'd sure hate to curtail everyone's vacation because of an Excel formula problem, but you know cost containment....
Formula we have at the moment:

=IF(OR(WEEKDAY($G$8,1)=1,WEEKDAY($G$8,1)=7, IF(ISNA(MATCH($G$8,COMPANY_HOLIDAYS,0)),
FALSE,TRUE)),"N",IF(ISERROR(HOLIDAY($G$8,$B$8,$C$8,$B$9,$C$9,$B$10,$C$10,$B$11,
$C$11,$B$12,$C$12,"",$E$8,$E$9,$E$10,$E$11,$E$12)),"",HOLIDAY($G$8,$B$8,$C$8,$B$9,$C$9,
$B$10,$C$10,$B$11,$C$11,$B$12,$C$12,"",$E$8,$E$9,$E$10,$E$11,$E$12)))

Beginning of formula establishes Sat and Sun and Holidays as Not Worked "N", but it gets fuzzy from there. Formula does work for the indicated cells. Any and all input welcome. Many thanks and all the best.
 

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)
HI - welcome to the board!

1) Replace the OR in the first part of the if with the workday() function

2) "Holiday" is not a native excel function, so either (a) you've got a user defined function called 'holiday', in which case we'll need to see the code, or (b) something's gone horribly wrong :). What are you trying to do in those sections? Either way, the fact that you seem reduced to referencing all of the cells long-hand rather than refering to a range seems to indicate that there's probably a better way to do it.

Post back with a little more detail on the second section of your if(). Consider downloading the html maker addin from the link below this post & posting up a representative snapshot of your sheet.

More info please!

paddy
 
Upvote 0
Paddy:

Thanks for the speedy reply. You hit the nail on the head, it was a custom function gizmo lurking in the background. One of the wizards must have created it and a simple country boy like me didn't know about such things. So, after boning up a wee bit, uncovered the following which is clearly limited to 5 rows and our hamstring. It does work when you extend it so we should be ok, but it sure seems like there should be a simpler way than hardcoding all those cells (it's over the top for 20 rows, in fact it bombed with too many arguments). Again, thanks and all comments/suggestions welcome.

ZSandman
ps. I'll try and download that stuff to make my postings easier to work with 8->
--------------------------------------------
Function HOLIDAY(VDate, Date1, Date2, Date3, Date4, Date5, Date6, Date7, Date8, Date9, Date10, TC0, TC1, TC2, TC3, TC4, TC5)

If VDate < Date1 Then
HOLIDAY = TC0
ElseIf VDate <= Date2 Then
HOLIDAY = TC1
ElseIf VDate > Date2 And Date3 = 0 Then
HOLIDAY = TC0
ElseIf VDate < Date3 Then
HOLIDAY = TC0
ElseIf VDate <= Date4 Then
HOLIDAY = TC2
ElseIf VDate > Date4 And Date5 = 0 Then
HOLIDAY = TC0
ElseIf VDate < Date5 Then
HOLIDAY = TC0
ElseIf VDate <= Date6 Then
HOLIDAY = TC3
ElseIf VDate > Date6 And Date7 = 0 Then
HOLIDAY = TC0
ElseIf VDate < Date7 Then
HOLIDAY = TC0
ElseIf VDate <= Date8 Then
HOLIDAY = TC4
ElseIf VDate > Date8 And Date9 = 0 Then
HOLIDAY = TC0
ElseIf VDate < Date9 Then
HOLIDAY = TC0
ElseIf VDate <= Date10 Then
HOLIDAY = TC5
ElseIf VDate > Date10 Then
HOLIDAY = TC0
End If
End Function
 
Upvote 0

Forum statistics

Threads
1,215,884
Messages
6,127,562
Members
449,385
Latest member
KMGLarson

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