Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default how to tighten up unwieldy formula

It has taken some time to finally come up with this formula, Chip
Pearson's page gets most of the credit.


=IF($R
$6TODAY(),SUMPRODUCT((Fiscal="F2008")*(quarter="q 2")*(WeekdayAll=4)),SUMPRODUCT((Fiscal="F2008")*(q uarter="Q2")*(WeekdayAll=4))-
(SUM(IF(WEEKDAY($Q$6-1+ROW(INDIRECT("1:"&TRUNC($R$6-$Q
$6)+1)))=4,1,0))))

$r$6 is today's date, $Q$6 is (december 1, 2007) the first day of the
second quarter of our fiscal year (F2008)

the formula uses those two dates to determine how many Thursdays
remain in the quarter, (all of the Thursdays in the quarter minus all
of Thursdays in the quarter prior to today's date.

If the quarter has passed (quarter 1, sep-1-07 to nov-30-07) the
formula display 0 remaining, if the quarter is in the future (q3) it
displays the total number Thursdays in that quarter.

I'm thinking the TRUNC might go, because I'm not dealing with times,
unless I misunderstand.

Naming the formula that appears twice might be an idea too...

anything obvious to you more knowledgeble Excel-ers?

Andy Fox

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default how to tighten up unwieldy formula

Your SUMPRODUCT term appears twice, and you basically have:

=IF( condition, SP_formula, SP_formula - SUM_IF_formula )

So, you could avoid some duplication by writing this as:

=SP_formula - IF( condition,0,SUM_IF_formula )

I've not really looked at the SUM_IF_formula.

Hope this helps.

Pete

On Jan 30, 2:15*pm, Green Fox wrote:
It has taken some time to finally come up with this formula, Chip
Pearson's page gets most of the credit.

=IF($R
$6TODAY(),SUMPRODUCT((Fiscal="F2008")*(quarter="q 2")*(WeekdayAll=4)),SUMPR*ODUCT((Fiscal="F2008")*( quarter="Q2")*(WeekdayAll=4))-
(SUM(IF(WEEKDAY($Q$6-1+ROW(INDIRECT("1:"&TRUNC($R$6-$Q
$6)+1)))=4,1,0))))

$r$6 is today's date, $Q$6 is (december 1, 2007) the first day of the
second quarter of our fiscal year (F2008)

the formula uses those two dates to determine how many Thursdays
remain in the quarter, (all of the Thursdays in the quarter *minus all
of Thursdays in the quarter prior to today's date.

If the quarter has passed (quarter 1, sep-1-07 to nov-30-07) the
formula display 0 remaining, if the quarter is in the future (q3) it
displays the total number Thursdays in that quarter.

I'm thinking the TRUNC might go, because I'm not dealing with times,
unless I misunderstand.

Naming the formula that appears twice might be an idea too...

anything obvious to you more knowledgeble Excel-ers?

Andy Fox


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default how to tighten up unwieldy formula

You will need to check me out, of course, but if I did everything correctly,
this formula...

=(WEEKDAY(R6)=5)+SUMPRODUCT(--(WEEKDAY(R6+ROW(INDIRECT("1:"&(DATE(YEAR(Q6),MONTH (Q6)+3,1)-R6))))=5))

will return the number of Thursdays remaining in the quarter (that started
with the date specified in R6 and ended with the date specified in Q6).
Notice, all calculations are being done from the values in R6 and Q6 alone
and that the value in R6 (the start of the quarter) is assumed to always be
the first day of the month. Also note that if the date in R6 is a Thursday,
it is counted as one of the remaining Thursdays in the quarter (remove the
first weekday test and leave only the SUMPRODUCT part if you want to exclude
the starting date being a Thursday from the count).

Rick



"Green Fox" wrote in message
...
It has taken some time to finally come up with this formula, Chip
Pearson's page gets most of the credit.


=IF($R
$6TODAY(),SUMPRODUCT((Fiscal="F2008")*(quarter="q 2")*(WeekdayAll=4)),SUMPRODUCT((Fiscal="F2008")*(q uarter="Q2")*(WeekdayAll=4))-
(SUM(IF(WEEKDAY($Q$6-1+ROW(INDIRECT("1:"&TRUNC($R$6-$Q
$6)+1)))=4,1,0))))

$r$6 is today's date, $Q$6 is (december 1, 2007) the first day of the
second quarter of our fiscal year (F2008)

the formula uses those two dates to determine how many Thursdays
remain in the quarter, (all of the Thursdays in the quarter minus all
of Thursdays in the quarter prior to today's date.

If the quarter has passed (quarter 1, sep-1-07 to nov-30-07) the
formula display 0 remaining, if the quarter is in the future (q3) it
displays the total number Thursdays in that quarter.

I'm thinking the TRUNC might go, because I'm not dealing with times,
unless I misunderstand.

Naming the formula that appears twice might be an idea too...

anything obvious to you more knowledgeble Excel-ers?

Andy Fox


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,180
Default how to tighten up unwieldy formula

No formula needed.
You can create a Pivot Table instead
from your existing data.
http://www.freefilehosting.net/download/3b8cl

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 y-axis want to use a macro to tighten the range on both HBS Charts and Charting in Excel 1 October 3rd 05 08:19 PM


All times are GMT +1. The time now is 06:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"