+ Reply to Thread
Results 1 to 3 of 3

Adding CountIf Statement within If/ElseIf Statement

  1. #1
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    228

    Adding CountIf Statement within If/ElseIf Statement

    Hi Everyone,

    Below is the code I'm looking to add to. I'm not really sure if a CountIf is what I'm looking for but I think it should work. In addition to the criteria shown below, I'd also like to add something that says "if the left 4 characters in (Cells(i, "A").Value) show up in Sheet1!J:J, then Cells(i, "D").Formula =... if they show up in Sheet1!K:K, then Cells(i, "D").Formula =...

    Also, if anyone knows a good way to consolidate all of this, that would be great!

    Please Login or Register  to view this content.
    Let me know if you have any questions.

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Adding CountIf Statement within If/ElseIf Statement

    I'm no VBA expert and this doesn't answer your main question but I think you can shorten that code to this (UNTESTED):

    Please Login or Register  to view this content.
    Last edited by Special-K; 09-17-2014 at 05:14 AM.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Adding CountIf Statement within If/ElseIf Statement

    Hi,

    Why do you need a macro when it seems normal excel functions will deliver?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ 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. Code stepping in to elseif statement when elseif is definitely not true
    By DFrank231 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2013, 05:31 PM
  2. Adding an AND Statement to COUNTIF
    By CLR in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-06-2005, 07:05 AM
  3. Adding an AND Statement to COUNTIF
    By Kenton_SJ in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  4. Adding an AND Statement to COUNTIF
    By Kenton_SJ in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. [SOLVED] Adding an AND Statement to COUNTIF
    By Kenton_SJ in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-17-2005, 07:05 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