Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook and IF,THEN, ELSE

Thank you in advance for any responses.

I am trying to make a cell sum a range of cells based on what month i
is according to the system clock. If the clock shows January then SU
g3:j3, if the clock shows February then SUM k3:n3 and so on...
Thank you again

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Workbook and IF,THEN, ELSE

Hi PoolShark!

One way. Try:

=SUM(INDIRECT("R3C"&3+(MONTH(TODAY())*4)&":R3C"&6+ (MONTH(TODAY())*4),0
))

I use INDIRECT with the False second argument to construct a
calculated R1C1 reference.
--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Workbook and IF,THEN, ELSE

Poolshark,

=SUM(OFFSET(G3:J3,0,(MONTH(NOW())-1)*4))

Rob


"poolshark " wrote in message
...
Thank you in advance for any responses.

I am trying to make a cell sum a range of cells based on what month it
is according to the system clock. If the clock shows January then SUM
g3:j3, if the clock shows February then SUM k3:n3 and so on...
Thank you again.


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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Workbook and IF,THEN, ELSE

On Sat, 24 Jan 2004 22:55:49 -0600, poolshark
wrote:

I am trying to make a cell sum a range of cells based on what month it
is according to the system clock. If the clock shows January then SUM
g3:j3, if the clock shows February then SUM k3:n3 and so on...
Thank you again.


You could do this in a single formula, but just to make it clearer
I'll break it into two steps:

First you need to know which column you want to start at. One way to
determine that is through a CHOOSE function. Let's say that you have
that function in cell A1:
=CHOOSE(MONTH(NOW()),6,11,16,21,26,31)

I've typed only the first 6 months because I'm basically lazy, but
you'd put all 12 in. The NOW() function returns the current date. The
MONTH function returns the number of the current month. The CHOOSE
function says "If it's month 1, return 6. If it's month 2, return 11"
and so on. The number that it returns in this case is the column that
you start adding from. (G3 is in column 6, K3 is in column 11; you get
the idea.)

Now you can have the SUM function:
=SUM(OFFSET(A3,0,$A$1):OFFSET(A3,0,$A$1+3))

That is, sum the cells which are offset from cell A3 by:
0 rows; and
However many columns the CHOOSE formula returns to the choose
function's value +3. (In your example you're always adding 4 columns).

This can of course be copied down as far as you want to add rows all
the way down your sheet if you wish.

There are doubtless other ways of doing it, perhaps even some more
elegant, but hey, this'll get the job done...


---------------------------------------------------------
Hank Scorpio
- Yes, yes, I know I've been missing for a while. Long story. And don't
ask what the size of my inbox is at the moment either... 8^
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Workbook and IF,THEN, ELSE

poolshark,
in VBA,
evaluate("=SUM(OFFSET(A1,2,2+MONTH(TODAY())*4,1,4) )")
in worksheet
=SUM(OFFSET(A1,2,2+MONTH(TODAY())*4,1,4))
HTH
Cecil

"poolshark " wrote in message
...
Thank you in advance for any responses.

I am trying to make a cell sum a range of cells based on what month it
is according to the system clock. If the clock shows January then SUM
g3:j3, if the clock shows February then SUM k3:n3 and so on...
Thank you again.


---
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
Adding a chart to large workbook brings workbook activity to a hal Dale Excel Discussion (Misc queries) 6 December 29th 08 05:50 PM
Excel-how to link source workbook to copy of destination workbook D Lynn Excel Worksheet Functions 1 May 29th 08 05:36 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please harry Excel Programming 5 December 20th 03 03:26 AM
What commands do you use to name a workbook, save a workbook,open a workbook Steven R. Berke Excel Programming 1 July 24th 03 11:37 PM


All times are GMT +1. The time now is 11:16 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"