function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hogehogehogehoge 

Help me! This

Check what week of the year a date is To find out what week of the year a date is in, use the formula: What formula can you have if you want a year to start on April 1st and end on March 31st?
IF( 
  CEILING( ( date - DATE( YEAR( date ), 1, 1) + 1) / 7) > 52,
  52,
  CEILING( ( date - DATE( YEAR( date ), 1, 1) + 1) / 7)
)
Best Answer chosen by hogehoge
AnkaiahAnkaiah (Salesforce Developers) 
Hi,

To find the current week number, determine the days to date in the current year and divide that value by 7. The IF() statement ensures that the week number the formula returns doesn’t exceed 52. So if the given date is December 31 of the given year, the formula returns 52, even though it’s more than 52 weeks after the first week of January.

52 is week number in a year ==> 52*7 = 364 days

CEILING function use:
numbers are rounded up (to the nearest integer)
ex: CEILING (2.5) = 3.0

Hope this clear.

If this helps, Please mark it as best answer.

Thanks!!
 

All Answers

AnkaiahAnkaiah (Salesforce Developers) 
Hi,

Can you explain clearly about your issue?

Thanks!!
hogehogehogehoge
IF(MONTH(FulfillingAggregateDate__c ) >= 4,
IF(
CEILING( ( FulfillingAggregateDate__c - DATE( YEAR( FulfillingAggregateDate__c ), 04, 01) + 1) / 7) > 52,
52,
CEILING( ( FulfillingAggregateDate__c - DATE( YEAR( FulfillingAggregateDate__c ), 04, 01) + 1) / 7)
),
IF(
CEILING( ( FulfillingAggregateDate__c - DATE( YEAR( FulfillingAggregateDate__c ) - 1, 04, 01) + 1) / 7) > 52,
52,
CEILING( ( FulfillingAggregateDate__c - DATE( YEAR( FulfillingAggregateDate__c ) - 1, 04, 01) + 1) / 7)
)

Sorry, this formula counts weeks from April 1st. Please explain this formula. The syntax is correct. What is 52? How do you calculate the week by looking at the date?
AnkaiahAnkaiah (Salesforce Developers) 
Hi,

To find the current week number, determine the days to date in the current year and divide that value by 7. The IF() statement ensures that the week number the formula returns doesn’t exceed 52. So if the given date is December 31 of the given year, the formula returns 52, even though it’s more than 52 weeks after the first week of January.

52 is week number in a year ==> 52*7 = 364 days

CEILING function use:
numbers are rounded up (to the nearest integer)
ex: CEILING (2.5) = 3.0

Hope this clear.

If this helps, Please mark it as best answer.

Thanks!!
 
This was selected as the best answer