RE: $$Excel-Macros$$ Re: How does the Mod operator work with dates

2013-04-05 Thread Jeffrey Wu
Dear Prince

 

Thank you very much for the reply, now it all makes sense!  Much
appreciated, wish all the best for you!

 

Best Regards

 

Jeff Wu

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Prince
Sent: Thursday, April 4, 2013 2:15 AM
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ Re: How does the Mod operator work with dates

 

Hi jeff Wu

 

In excel every date has some number corresponding to it  it. and it start at
the date  "01-jan-1900" for this date the number is 1 and for the date
"02-jan-1900" the number is 2 and so on. so whenever we do any calculation
first the date is converted into its corresponding number and then only its
result is evluated.

 

And in your case you can see the corresponding number of the date April 7
2003 is 37718 you nac see this just format the cell B3 as number.

 

Hope it will provide you more clear view about the Date.

 

Regards

Prince

On Wednesday, April 3, 2013 12:36:12 AM UTC+5:30, Excelrocks wrote:

Dear All

 

How are you?  I'm trying to learn VBA by following examples in the Excel
Macro book I got.  I got stuck with one of the function examples relating to
using Mod operator with date.  This example converts week number to a date.
Please see the attached Macro for details.  I'm having trouble figuring out
the line:

 

FirstMon = FirstMon - FirstMon Mod 7 + 2

 

I understand how MOD works with numbers but just don't understand how a date
can be divided by a number. In this case I know this equation figures out
the first Monday of any given year but just couldn't figure out how to
divide a date to get the remainder, and also I couldn't figure out the logic
of the + 2 was there for?  Any feedbacks will be much appreciated!

 

Best Regards

 

Jeff Wu

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It's
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security
measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups
"MS EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




$$Excel-Macros$$ How does the Mod operator work with dates

2013-04-02 Thread Jeffrey Wu
Dear All

 

How are you?  I'm trying to learn VBA by following examples in the Excel
Macro book I got.  I got stuck with one of the function examples relating to
using Mod operator with date.  This example converts week number to a date.
Please see the attached Macro for details.  I'm having trouble figuring out
the line:

 

FirstMon = FirstMon - FirstMon Mod 7 + 2

 

I understand how MOD works with numbers but just don't understand how a date
can be divided by a number. In this case I know this equation figures out
the first Monday of any given year but just couldn't figure out how to
divide a date to get the remainder, and also I couldn't figure out the logic
of the + 2 was there for?  Any feedbacks will be much appreciated!

 

Best Regards

 

Jeff Wu

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Convert Week no. to a date.xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12