Workday Formula

Cpinhey

New Member
Joined
Jul 7, 2011
Messages
21
Hi,

I'm setting up some workbooks for the new financial year 2012-13 and I've got a problem with a workdays formula that has worked perfectly well for this current year, 2011-12.

Here is the formula:

=IF(WORKDAY(A$1,ROW(A1)-ROW(A$1),BankHolidays)>A$2,"",TEXT(WORKDAY(A$1,ROW(A1)-ROW(A$1),BankHolidays),"dd/mm/yyyy"))

A1 = First day of year
A2 = Last day of year
BankHolidays = Named Range of UK Bank Holidays

I populate a column with the formula to get a list of all the working days for the whole year.

My problem is when I have tried this formula for this new financial year, start date 01/04/2012 and end date 31/03/2013, I keep getting 01/04/2012 as the first working day, but 01/04/2012 is a non working day (sunday) I've checked have all Bank Holidays entered correctly.

I think I'm probably missing something really simple here, would appreciate any ideas?

Or does someone have a better way of generating a list of all working days for an entire financial year?
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Perhaps

=IF(WORKDAY(A$1-1,ROWS(A$1:A1),BankHolidays)>A$2,"",TEXT(WORKDAY(A$1-1,ROWS(A$1:A1),BankHolidays),"dd/mm/yyyy"))
 

Cpinhey

New Member
Joined
Jul 7, 2011
Messages
21
I think that has done the trick.

Thanks for your help, I had to admit defeat on this one.
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Glad to help...

also, you can reduce the calculations considerably..

Put this in the FIRST cell (Say E1 or whatever)
=IF(WORKDAY(A$1-1,ROWS(A$1:A1),BankHolidays)>A$2,"",TEXT(WORKDAY(A$1-1,ROWS(A$1:A1),BankHolidays),"dd/mm/yyyy")+0)

Then in the rest, you only need to test the previous formula for >A2, thus reducing calculations
=IF(E1>=A$2,"",TEXT(WORKDAY(A$1-1,ROWS(A$1:A2),BankHolidays),"dd/mm/yyyy")+0)
 
Last edited:

Cpinhey

New Member
Joined
Jul 7, 2011
Messages
21
Amazing. Thank u. I'd never have thought to do it that way.
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
...but that second formula won't work correctly if the end date is a non-working day, e.g. if you have A2 = Sun 31/3/2013 as stated then you'll get dates up to 1/4/2013.

I'd suggest using just this in E1

=WORKDAY(A$1-1,1,BankHolidays)

and in E2 copied down

=IF(E1="","",IF(WORKDAY(E1,1,BankHolidays)>A$2,"",WORKDAY(E1,1,BankHolidays)))

format all cells with required date format
 

Cpinhey

New Member
Joined
Jul 7, 2011
Messages
21
Ah, I think i see what u mean. I've just logged off, will give this a whirl when im back in the office tomorrow morning.

Thanks you.
 

Forum statistics

Threads
1,082,280
Messages
5,364,210
Members
400,786
Latest member
ismi88

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top