Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA- If Then statement

Please help. I need to write a couple lines of codes in excel to tel
the worksheet if it's month 1,2,3 then place a certain in qtr1, if th
month number is 4,5,6 then place the value in qtr2. I don' think it'
too complicated but being new to vba.....i'm helpless....thanks for al
your help.

Tam

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Excel VBA- If Then statement

Do you mean in VBA?

This returns the qtr of the current date

int((month(date)-1)/ 3)+1

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"tam76131 " wrote in message
...
Please help. I need to write a couple lines of codes in excel to tell
the worksheet if it's month 1,2,3 then place a certain in qtr1, if the
month number is 4,5,6 then place the value in qtr2. I don' think it's
too complicated but being new to vba.....i'm helpless....thanks for all
your help.

Tami


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Excel VBA- If Then statement

The Select Case statement is designed for this type
of "multiple condition 'if'"

Select Case MonthNo
Case 1, 2, 3
qtr1 = .....
Case 4, 5, 6
qtr2 = ....
Case 7, 8, 9
qtr3 = ...
Case Else
qtr4 = ...
End Select

-----Original Message-----
Please help. I need to write a couple lines of codes in

excel to tell
the worksheet if it's month 1,2,3 then place a certain in

qtr1, if the
month number is 4,5,6 then place the value in qtr2. I

don' think it's
too complicated but being new to vba.....i'm

helpless....thanks for all
your help.

Tami


---
Message posted from http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Excel VBA- If Then statement

For another possibility (not the best, IMO)

=DatePart("Q",DateSerial(2004,MonthNo,1))

The best, I think, is the first suggestion you got.

On Tue, 17 Aug 2004 11:27:50 -0700, "K Dales"
wrote:

The Select Case statement is designed for this type
of "multiple condition 'if'"

Select Case MonthNo
Case 1, 2, 3
qtr1 = .....
Case 4, 5, 6
qtr2 = ....
Case 7, 8, 9
qtr3 = ...
Case Else
qtr4 = ...
End Select

-----Original Message-----
Please help. I need to write a couple lines of codes in

excel to tell
the worksheet if it's month 1,2,3 then place a certain in

qtr1, if the
month number is 4,5,6 then place the value in qtr2. I

don' think it's
too complicated but being new to vba.....i'm

helpless....thanks for all
your help.

Tami


---
Message posted from http://www.ExcelForum.com/

.


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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
Excel IF Then Statement Shaun[_2_] Excel Discussion (Misc queries) 0 February 21st 07 07:48 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM


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

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

About Us

"It's about Microsoft Excel"