+ Reply to Thread
Results 1 to 5 of 5

Using SheetName macro inside a COUNTIF function

  1. #1
    Registered User
    Join Date
    11-19-2022
    Location
    Montreal
    MS-Off Ver
    MS Office subscription (newest version)
    Posts
    3

    Using SheetName macro inside a COUNTIF function

    Hi all,

    I am trying to make a formula which will use values off of over 40 different sheets in the same workbook. I have made the SheetName macro and wish to use the name that this macro gives me inside other functions such as:
    Example:
    SheetName(1) = Sheet1
    COUNTIF(SheetName(1)!A1:A250,crtieria)

    This returns an error. Can anyone help me solve this issue? The major problem here is the name of each sheet will differ on a regular basis as this is for a weekly report generation.

    Thank you

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Using SheetName macro inside a COUNTIF function


    Hi,

    use the & operator to concatenate the strings …

  3. #3
    Registered User
    Join Date
    11-19-2022
    Location
    Montreal
    MS-Off Ver
    MS Office subscription (newest version)
    Posts
    3

    Re: Using SheetName macro inside a COUNTIF function

    Could you give me an example it doesn't seem to work. I have tried to concatenate the strings within the COUNTIF and it still gives me an error message for the formula.
    Last edited by Pi_Tremb; 11-19-2022 at 04:23 PM.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Using SheetName macro inside a COUNTIF function


    "text1" & "text2" like explained in VBA help …

  5. #5
    Registered User
    Join Date
    11-19-2022
    Location
    Montreal
    MS-Off Ver
    MS Office subscription (newest version)
    Posts
    3

    Re: Using SheetName macro inside a COUNTIF function

    I have tried and it still does not work the COUNTIF does not recognize the input.

+ 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. Displaying sheetname in cell does not work if sheetname=filename
    By xl999Excel in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-27-2022, 04:38 PM
  2. UNIQUE and FILTER inside COUNTIF(S) Function
    By dluhut in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-02-2022, 02:38 PM
  3. Using the Find Function inside the Right function in macro
    By namruht in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2013, 02:12 PM
  4. how to insert in macro - sheetname as function
    By phoenixwright in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2013, 06:39 PM
  5. Sheetname/row/col lookup macro function
    By tysonhenry in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2011, 08:49 PM
  6. Problems with using a formula inside a countif function
    By flex in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-11-2008, 04:14 AM
  7. Can I use a Reference inside a SUMIF or COUNTIF Function?
    By Albie in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-13-2005, 06:25 PM

Tags for this Thread

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