+ Reply to Thread
Results 1 to 4 of 4

Variable area for countifs

  1. #1
    Registered User
    Join Date
    08-14-2011
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    63

    Variable area for countifs

    Dear all,

    I have a problem regarding the use of formula in which the range of area checking is a variable.

    You can open the attachment to be able to go through with me:

    In sheet1 I have table with 12 column and 6 rows (just for an example)

    From col I to L, there are header namely INSP, LUBE, TIGH, REPL

    The problem are as follow:
    For example: I need to tag in column LUBE with "L" if there is the exact database from colum A to D plus column F in Sheet LUBE

    The way I do at them moment is using the following code:
    - Assuming that active sheet is Sheet1
    - All dimension has been declared and known (i.e. lr1)

    Please Login or Register  to view this content.
    I found it to be too long and prone to mistake. Because if column A-E need to be added, then I need to alter the code to incorporate new if-syntax. the Can anyone give me suggestion on how to make the code shorter and more efficient.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Variable area for countifs

    You attached an xlsx file without macro, you pasted a not complete code
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Variable area for countifs

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    08-14-2011
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: Variable area for countifs

    Quote Originally Posted by AlphaFrog View Post
    Try this...
    Hi Alpha, thanks for providing a modification for my code. Is your code specifically for Sheet Lube? Is it possible to check the sheet Lube & Repl in one go and not to write your whole code again for different sheet?

    Thanks in advance.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Excel 2007 : COUNTIFS using variable to identify column referenced
    By sarahaley in forum Excel General
    Replies: 17
    Last Post: 05-07-2012, 12:03 PM
  2. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  3. Countifs VBA Syntax - variable row range
    By rasonline in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2011, 04:16 PM
  4. COUNTIFS Using Date Text as Variable
    By ltsolis in forum Excel General
    Replies: 3
    Last Post: 09-08-2011, 07:25 PM
  5. COUNTIFS with a variable condition
    By cjsec9 in forum Excel General
    Replies: 2
    Last Post: 04-01-2009, 02:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1