Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Break this down...

I came upon this formula with a 'record macro'. It worked for what I needed
to get done, but could someone break it down for me because it's confusing
and I'd like to use it for another report and also to expand to at least two
more columns with different criteria.

Basically what I did was, put my cursor on the field where the results would
go, and =countif, went into the second workbook to column P, selected the
column and typed in the criteria. It worked fine, I'm trying to do this for
another report and can't figure out what this formula really reads like. The
confusing part is the what's in between the brackets [] and that it has 'C'
instead of 'P', which is where the info came from. Thanks in advance.

Range("E6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[11],""Austria"")"
Range("F6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[10],""Belgium"")"
Range("G6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[9],""Germany"")"
Range("H6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[8],""Ireland"")"
Range("I6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[7],""Italy"")"
Range("J6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[6],""Luxembourg"")"
Range("K6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[5],""Netherlands"")"
Range("L6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[4],""Switzerland"")"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Break this down...

Your formula is in R1C1 mode meaning that it uses the relative row and column
number to address your cells. C[11] is column 11. So column P is 11 columns
over from cell E6...
--
HTH...

Jim Thomlinson


"CV323" wrote:

I came upon this formula with a 'record macro'. It worked for what I needed
to get done, but could someone break it down for me because it's confusing
and I'd like to use it for another report and also to expand to at least two
more columns with different criteria.

Basically what I did was, put my cursor on the field where the results would
go, and =countif, went into the second workbook to column P, selected the
column and typed in the criteria. It worked fine, I'm trying to do this for
another report and can't figure out what this formula really reads like. The
confusing part is the what's in between the brackets [] and that it has 'C'
instead of 'P', which is where the info came from. Thanks in advance.

Range("E6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[11],""Austria"")"
Range("F6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[10],""Belgium"")"
Range("G6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[9],""Germany"")"
Range("H6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[8],""Ireland"")"
Range("I6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[7],""Italy"")"
Range("J6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[6],""Luxembourg"")"
Range("K6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[5],""Netherlands"")"
Range("L6").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(ISCE!C[4],""Switzerland"")"

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Break this down...


Ok makes sense now. I was confused on that C.

I realized that I got the info while the sheets were on the same workbook.

What if the info is in another workbook? It comes back saying that I
entered too few arguments. Is it not possible to "=countif" with the data in
two separate workbooks?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Break this down...

Did you record a macro to add the reference to the new workbook or did you
try to modify the code that you have? In either case post the code that you
have...

If you want to do a CountIf to a seperate workbook I think you might run
into an issue if the externally referenced workbook is closed because CountIf
doe not like referencing closed books. Take a look at this web site...

http://www.xldynamic.com/source/xld.SUMPRODUCT.html
--
HTH...

Jim Thomlinson


"CV323" wrote:


Ok makes sense now. I was confused on that C.

I realized that I got the info while the sheets were on the same workbook.

What if the info is in another workbook? It comes back saying that I
entered too few arguments. Is it not possible to "=countif" with the data in
two separate workbooks?

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
Excel 2007 Page Break Adjustments causes a page break each cell BKaufman Excel Worksheet Functions 2 September 10th 10 05:02 AM
Break a link between workbooks when there is no "break" option FruitNLoops Excel Discussion (Misc queries) 2 January 31st 09 05:16 AM
Break cell into multiple lines by line break Chia Excel Discussion (Misc queries) 1 August 20th 06 06:37 AM
adding a new page break to an existing page break Edward Letendre Excel Discussion (Misc queries) 1 March 6th 05 09:29 AM
Can Not Get Macro to Break with CTRL-BREAK Break Me? Excel Programming 0 September 8th 04 03:15 AM


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