Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Bob,
Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ********************************* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TODAY(),0))=1,EOMONTH(TODAY() ,0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#2
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Hi Epinn,
I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#3
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Bob,
Sorry, I disappointed you. <g I am glad that I didn't spend hours trying to analyze what they put on the web site. May be the info there is not so reliable after all?? Yes, I agree that I only need to load. I did it once for another function and that was what I had in mind even though I said "installed." I should get some sleep. Wow! You can shrink the formula to half!! However, I don't have a clue how to decipher it. Regarding the last (third) formula, this is the first time I see an equal sign in a formula without "if" present. I don't know if that little dash means minus and I don't understand the array constants. But I don't want to take up your time explaining it to me as I prefer you help me on something else that may need more of my attention in the future. You know, I don't feel like "bugging" you all day long. I'll just keep this formula in my bag for now. Cheers, Epinn "Bob Phillips" wrote in message ... Hi Epinn, I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#4
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]() "Epinn" wrote in message ... Bob, Sorry, I disappointed you. <g I am glad that I didn't spend hours trying to analyze what they put on the web site. May be the info there is not so reliable after all?? The problem was that it was testing the last day for Friday or Sunday, it should be testing for Saturday or Sunday. Wow! You can shrink the formula to half!! However, I don't have a clue how to decipher it. Regarding the last (third) formula, this is the first time I see an equal sign in a formula without "if" present. I doubt that Epinn, it is just testing a condition. I think you will have seen that many times in SUMPRODUCT =SUMPRODUCT((rng1="A")*(rng2="B")) so as before it is just getting a TRUE/FALSE result which is being coerced by the * operator (again, just like you have seen in SUMPRODUCT). The different thing here is I test against two value {1,7} and then using two multipliers {2,1} which will get a value depending upon the day of the week that the last day falls on. I don't know if that little dash means minus and I don't understand the array constants. But I don't want to take up your time explaining it to me as I prefer you help me on something else that may need more of my attention in the future. You know, I don't feel like "bugging" you all day long. I'll just keep this formula in my bag for now. I fear you are getting information overload now mate <g. That dash certainly does mean minus, The formula just calculates the last date of the month, then calculates if that last day is a Saturday or Sunday and calculates the number of days to subtract if so, and subtracts them =Get_end_of_month_date - adjustment where adjustment = If(day_of_end_of_month_date = Sat or Sun, return 1 or 2, else return 0) |
#5
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Shorter still: (ATP required)
=WORKDAY(EOMONTH(A1,0)-7,5) Biff "Bob Phillips" wrote in message ... Hi Epinn, I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#6
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Biff,
You are anal (said with love, humour, and grace :-)) Bob "Biff" wrote in message ... Shorter still: (ATP required) =WORKDAY(EOMONTH(A1,0)-7,5) Biff "Bob Phillips" wrote in message ... Hi Epinn, I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#7
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
That "love" and "grace" have *interesting* connotations!<vbg
-- Regards, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may benefit ! --------------------------------------------------------------------------- "Bob Phillips" wrote in message ... Biff, You are anal (said with love, humour, and grace :-)) Bob "Biff" wrote in message ... Shorter still: (ATP required) =WORKDAY(EOMONTH(A1,0)-7,5) Biff "Bob Phillips" wrote in message ... Hi Epinn, I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#8
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I love his work, and I gracefully acknowledge his skill and expertise <vbg
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Ragdyer" wrote in message ... That "love" and "grace" have *interesting* connotations!<vbg -- Regards, RD -------------------------------------------------------------------------- - Please keep all correspondence within the NewsGroup, so all may benefit ! -------------------------------------------------------------------------- - "Bob Phillips" wrote in message ... Biff, You are anal (said with love, humour, and grace :-)) Bob "Biff" wrote in message ... Shorter still: (ATP required) =WORKDAY(EOMONTH(A1,0)-7,5) Biff "Bob Phillips" wrote in message ... Hi Epinn, I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#9
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Biff,
You are anal .... Yes, I know. I think I have OCD (perfectionist). Just wait 'til I get this stuff figured out! Biff "Bob Phillips" wrote in message ... Biff, You are anal (said with love, humour, and grace :-)) Bob "Biff" wrote in message ... Shorter still: (ATP required) =WORKDAY(EOMONTH(A1,0)-7,5) Biff "Bob Phillips" wrote in message ... Hi Epinn, I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#10
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
What happens if you don't want to or can't use ATP functions? Then it gets
much more complicated! I'm sure there is a better way to do this but this is the first thing that came to my mind. This is an array formula and it also demonstrates the 0th day of the month that I mentioned in the "Weekday" thread: =MAX(IF(WEEKDAY(ROW(INDIRECT(DATE(YEAR(A1),MONTH(A 1),1)&":"&DATE(YEAR(A1),MONTH(A1)+1,0))),2)<6,ROW( INDIRECT(DATE(YEAR(A1),MONTH(A1),1)&":"&DATE(YEAR( A1),MONTH(A1)+1,0))))) Biff "Biff" wrote in message ... Shorter still: (ATP required) =WORKDAY(EOMONTH(A1,0)-7,5) Biff "Bob Phillips" wrote in message ... Hi Epinn, I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#11
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I gave an alternate solution non-ATP earlier
=DATE(YEAR(A1),MONTH(A1)+1,0)-(MAX(0,WEEKDAY(DATE(YEAR(A1),MONTH(A1)+1,0),2) -5)) and non-array -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Biff" wrote in message ... What happens if you don't want to or can't use ATP functions? Then it gets much more complicated! I'm sure there is a better way to do this but this is the first thing that came to my mind. This is an array formula and it also demonstrates the 0th day of the month that I mentioned in the "Weekday" thread: =MAX(IF(WEEKDAY(ROW(INDIRECT(DATE(YEAR(A1),MONTH(A 1),1)&":"&DATE(YEAR(A1),MO NTH(A1)+1,0))),2)<6,ROW(INDIRECT(DATE(YEAR(A1),MON TH(A1),1)&":"&DATE(YEAR(A1 ),MONTH(A1)+1,0))))) Biff "Biff" wrote in message ... Shorter still: (ATP required) =WORKDAY(EOMONTH(A1,0)-7,5) Biff "Bob Phillips" wrote in message ... Hi Epinn, I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
#12
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
"Epinn" wrote in message
... I don't understand Biff's shortest formula though. =WORKDAY(EOMONTH(A1,0)-7,5) "5" means there are five work days, right? Can't figure out minus 7? 7 is Saturday or 7 means 7 days in a week. I don't want to torture my brain too much now ...... It.s nothing to do with Saturday. What is happening is that the formula first calculates the end of monthe date, and then takes 7 off of that to go back into the month. Thus, if the last day is a Saturday, it will take you back to the previous Saturday, Tuesday goes to Tuesday. WORKDAY is then invoked with that date + 5 days which MUST take you to the last working days (i.e 5 on Sat is Fri, 5 on Tue is Tue). I won't worry about the non-ATP formulae as I want to prevent a short-circuit. Chicken <vbg http://www.cpearson.com/excel/DateTimeWS.htm C. Pearson is a popular name around here, right? Is he an MVP? He uses non-ATP formulae. Not sure if they are identical to the ones suggested here. Too lazy to check. Great site, great guy. He is indeed an MVP. Is Biff a real name or is it an acronym like Epinn? Does Biff stand for "big in functions/ formulae" by chance? ;) Could be an NG handle, I must admit I have always assumed that it is. But if you recall, in Back to The Future, Marty's adversary is called Biff Tannen, so it could be real. |
#13
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Since your system date is wrong, I am taking the liberty of deleting your
message. Some do this on purpose to make sure that their message is at the top. Did you? -- Don Guillett SalesAid Software "Epinn" wrote in message ... Hi all, Bob is more than a demonstrative teacher; he is understanding too. Yes, it was a case of information overload. I thought I had never seen an equal sign without "if" when I actually saw it quite a few times with SUMPRODUCT. After staying away from this thread for a couple of days and coming back fresh, I have a better grasp of the formulae. =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) The above formula is so straight-forward that I can understand easily. =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) I finally understand this with Bob's English interpretation plus realizing the dash is a minus sign and the star is coercing and not a multiplication sign. Same idea as SUMPRODUCT, no big deal. I didn't know I could use this kind of format (array, coercing etc.) widely. What a relief! I don't understand Biff's shortest formula though. =WORKDAY(EOMONTH(A1,0)-7,5) "5" means there are five work days, right? Can't figure out minus 7? 7 is Saturday or 7 means 7 days in a week. I don't want to torture my brain too much now ...... I won't worry about the non-ATP formulae as I want to prevent a short-circuit. I lost faith in that web site as they had the wrong formula. Now, I am switching to another web site with lots of goodies. http://www.cpearson.com/excel/DateTimeWS.htm C. Pearson is a popular name around here, right? Is he an MVP? He uses non-ATP formulae. Not sure if they are identical to the ones suggested here. Too lazy to check. Is Biff a real name or is it an acronym like Epinn? Does Biff stand for "big in functions/ formulae" by chance? ;) Thank you for the input. Epinn "Bob Phillips" wrote in message ... I gave an alternate solution non-ATP earlier =DATE(YEAR(A1),MONTH(A1)+1,0)-(MAX(0,WEEKDAY(DATE(YEAR(A1),MONTH(A1)+1,0),2) -5)) and non-array -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Biff" wrote in message ... What happens if you don't want to or can't use ATP functions? Then it gets much more complicated! I'm sure there is a better way to do this but this is the first thing that came to my mind. This is an array formula and it also demonstrates the 0th day of the month that I mentioned in the "Weekday" thread: =MAX(IF(WEEKDAY(ROW(INDIRECT(DATE(YEAR(A1),MONTH(A 1),1)&":"&DATE(YEAR(A1),MO NTH(A1)+1,0))),2)<6,ROW(INDIRECT(DATE(YEAR(A1),MON TH(A1),1)&":"&DATE(YEAR(A1 ),MONTH(A1)+1,0))))) Biff "Biff" wrote in message ... Shorter still: (ATP required) =WORKDAY(EOMONTH(A1,0)-7,5) Biff "Bob Phillips" wrote in message ... Hi Epinn, I wonder what delights you will bring up here <g The EOMONTH formula you give below is wrong, it should be =IF(WEEKDAY(EOMONTH(TODAY(),0))=7,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) which can be shortened to =EOMONTH(TODAY(),0)-IF(WEEKDAY(EOMONTH(TODAY(),0))=7,1,IF(WEEKDAY(EOMO NTH(TO DAY(),0))=1,2,0)) which I think helps see what is happening, or even shorter at =EOMONTH(TODAY(),0)-(WEEKDAY(EOMONTH(TODAY(),0))={1,7})*({2,1}) As you say you need ATP for WORKDAY to function, but you probably have it installed, just not loaded. Goto ToolsAdd-Ins..., and check Analysis Toolpak. "Epinn" wrote in message ... Bob, Welcome to my new thread. Bob's formula for the last work day of the current month (brought over from another thread WEEKDAY is this:- =WORKDAY(DATE(YEAR(A1),MONTH(A1)+1,1),-1) Looks like this is similar to the second formula below which I like. I was "intimidated" by the first one below. It was almost three lines on my screeen. If I don't need to grasp EOMONTH(), I prefer not. I have to have ATP (Analysis Toolpak) to use WORKDAY(), right? My system told me #N/A!, so I have to install it. ************************************************** ************************** ******* a.. Last workday of the current month: =IF(WEEKDAY(EOMONTH(TODAY(),0))=6,EOMONTH(TODAY(), 0)-1,IF(WEEKDAY(EOMONTH(TO DAY(),0))=1,EOMONTH(TODAY(),0)-2,EOMONTH(TODAY(),0))) or =WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1),-1,Holidays) Source: http://www.officearticles.com/excel/...soft_excel.htm If link broken try this ...... http://tinyurl.com/mrzcc ************************************************** ************************** I will stay tuned. Epinn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|