+ Reply to Thread
Results 1 to 6 of 6

Function to count if cell each cell in horizontal range is max for it's respective column

  1. #1
    Registered User
    Join Date
    03-31-2016
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2010
    Posts
    3

    Function to count if cell each cell in horizontal range is max for it's respective column

    Good day,

    I am attempting to build a countif to count each cell, in range of cells in the same row (Myrange), that is the maximum for rows i-n to i+n in each cell's respective column. Currently the function below returns a 0 value in all application uses for any given row range and an n. Any assistance will be appreciated.



    Please Login or Register  to view this content.

  2. #2
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Function to count if cell each cell in horizontal range is max for it's respective col

    You are using MAX property incorrectly. The code you are using would check only 2 cells. This is how it should be used-

    Please Login or Register  to view this content.
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  3. #3
    Registered User
    Join Date
    03-31-2016
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2010
    Posts
    3

    Re: Function to count if cell each cell in horizontal range is max for it's respective col

    I see. I assumed that it would compute as a range similar to using the max function in the application. I see now even when using application functions in vba, I need to explicitly state a range.

    Thank you for the help!

  4. #4
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Function to count if cell each cell in horizontal range is max for it's respective col

    Yup.
    Actually the best way to debug a function is to convert the function to a macro like this (in a separate rough workbook) and then use F8 to run it line by line.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-31-2016
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2010
    Posts
    3

    Re: Function to count if cell each cell in horizontal range is max for it's respective col

    Did not think of that. Thanks, this is quite helpful.

  6. #6
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Function to count if cell each cell in horizontal range is max for it's respective col

    Glad to know that helped!

    If your query is resolved please take a moment to mark this thread as solved from the "Thread Tools" at the top of this page.
    You can also click on "Add Reputation" below my post if that was helpful.

+ 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. VBA to find cell value in column and count occurances in same row within date range
    By Furutsun in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2014, 11:55 AM
  2. Replies: 2
    Last Post: 01-30-2014, 06:21 PM
  3. Replies: 15
    Last Post: 08-24-2013, 10:05 AM
  4. [SOLVED] Find empty cell till next value merge or copy the respective cells in next column
    By rpriyadharsini1987 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2013, 03:46 AM
  5. [SOLVED] Matching a value in a column & then summing a respective cell from a the matched value..
    By Scottie in BKK in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-07-2012, 12:40 PM
  6. Replies: 3
    Last Post: 11-15-2010, 01:53 AM
  7. Replies: 3
    Last Post: 04-01-2009, 06:07 AM
  8. occurence /count of a cell value in a column/range
    By ankurzvohra in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2008, 12:59 AM

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