Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Generic function applied to column?

I'd like to know if there is a way to apply a function to a column that
will "execute" on each cell on that column. I have 3 columns where
columns A and B contain dates and I want the third column's cells to
display some text based upon the dates in it's respective cells on
columns A and B. So, I am trying to avoid going to every cell in
column C and entering a function such as: IF(A1 = B1, "Dates are
equal", "Dates are not equal"). In this scenario, I'd have to write a
similar function for rows 1, 2, 3, 4, etc. I'd like to write a
function such as (in pseudocode): IF(CurrentRowCell - 1 =
CurrentRowCell - 2, "Dates are equal", "Dates are not equal").

My goal is to write this generic function once and somehow make it
execute on column C. That way when any dates are changed on columns A
or B then the respective cell on column C would be automatically
updated. Is this possible?

I suppose another way to do this is to create a macro that I would have
to run (manually or based upon some event) that could iterate through
all the cells in columns A and B and update the respective cell in
column C.

Any help would be much appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Generic function applied to column?

Look at Worksheet event functions:

http://www.mvps.org/dmcritchie/excel/event.htm

E.g. Worksheet_Change could check if columns A and/or B had changed and then
test/change message in C

HTH

" wrote:

I'd like to know if there is a way to apply a function to a column that
will "execute" on each cell on that column. I have 3 columns where
columns A and B contain dates and I want the third column's cells to
display some text based upon the dates in it's respective cells on
columns A and B. So, I am trying to avoid going to every cell in
column C and entering a function such as: IF(A1 = B1, "Dates are
equal", "Dates are not equal"). In this scenario, I'd have to write a
similar function for rows 1, 2, 3, 4, etc. I'd like to write a
function such as (in pseudocode): IF(CurrentRowCell - 1 =
CurrentRowCell - 2, "Dates are equal", "Dates are not equal").

My goal is to write this generic function once and somehow make it
execute on column C. That way when any dates are changed on columns A
or B then the respective cell on column C would be automatically
updated. Is this possible?

I suppose another way to do this is to create a macro that I would have
to run (manually or based upon some event) that could iterate through
all the cells in columns A and B and update the respective cell in
column C.

Any help would be much appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Generic function applied to column?

What Topper writes is probably true, but if I understand what you want
to do it's really much easier than you think. Just make the formula one
time in row 1 and then copy and paste it to your other rows. Excel will
take care of adjusting the row references for you.

If you're putting the formula in Column C, it will be =IF(A1=B1,"Text
you want if TRUE","What you want if FALSE")

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
CF to Row after CF is applied to Column Dax Arroway Excel Worksheet Functions 2 November 17th 09 05:58 PM
CF for Row when CF is applied to Column Dax Arroway Excel Worksheet Functions 2 November 17th 09 05:56 PM
Create Generic Formula for Entire Column Andrea from MN Excel Worksheet Functions 1 November 11th 09 04:48 AM
Generic Pivot Chart Column Oshtruck user Excel Discussion (Misc queries) 1 August 31st 08 02:25 AM
Comparing Dates - Generic Function? [email protected] Excel Programming 2 March 8th 06 01:43 PM


All times are GMT +1. The time now is 12:10 AM.

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"