+ Reply to Thread
Results 1 to 13 of 13

COUNTIF using current column

  1. #1
    Registered User
    Join Date
    07-10-2016
    Location
    ENGLAND
    MS-Off Ver
    365
    Posts
    6

    COUNTIF using current column

    Hi,

    I have the following formula which works fine but i need to do this serveral times with different text

    =COUNTIF($C$3:$C$37,$AN8)

    is it possible to do something like

    =COUNTIF($COLUMN()$3:$COLUMN()$37,$AN8)

    Thanks in advance
    Last edited by Shaun07776; 07-12-2016 at 03:29 PM.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: COUNTIF using current column

    Hi Shaun07776 and welcome.

    Do you mean you're going to drag the formula across the worksheet and you want the column to increment each time?
    If so, remove the $'s on the column references.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,625

    Re: COUNTIF using current column

    You say you are doing this several times, so where does the count go? To the same cell each time or different cells?
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    07-10-2016
    Location
    ENGLAND
    MS-Off Ver
    365
    Posts
    6

    Re: COUNTIF using current column

    So i have a calendar which is counting how many evenings and weekends the engineers do.

    so i just need to count all the weekdays that have say SH in for the current column

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: COUNTIF using current column

    Probably easier to provide a solution if we could see the workbook. Any chance of you posting a desensitized sample one?

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    BSB

  6. #6
    Registered User
    Join Date
    07-10-2016
    Location
    ENGLAND
    MS-Off Ver
    365
    Posts
    6

    Re: COUNTIF using current column

    Well Turns out i had not thought it through.

    i've come up with this which is working, is there a better way to write it?

    =SUM((COUNTIF($C$3:$C$7,INDIRECT(ADDRESS(ROW(),40,4)))),(COUNTIF($C$10:$C$14,INDIRECT(ADDRESS(ROW(),40,4)))),(COUNTIF($C$17:$C$21,INDIRECT(ADDRESS(ROW(),40,4)))),(COUNTIF($C$24:$C$28,INDIRECT(ADDRESS(ROW(),40,4)))),(COUNTIF($C$31:$C$35,INDIRECT(ADDRESS(ROW(),40,4)))),(COUNTIF($C$38:$C$42,INDIRECT(ADDRESS(ROW(),40,4)))))

    Thanks

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: COUNTIF using current column

    Quote Originally Posted by Shaun07776 View Post
    is there a better way to write it?
    Hard to say without seeing a sample workbook so we can see exactly what you're trying to accomplish.

    BSB

  8. #8
    Registered User
    Join Date
    07-10-2016
    Location
    ENGLAND
    MS-Off Ver
    365
    Posts
    6

    Re: COUNTIF using current column

    Hi,

    I've attached an example
    Attached Files Attached Files

  9. #9
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: COUNTIF using current column

    I assume you're working on a formula for cell AO4 and below.
    Rather than all that cumbersome INDIRECT and ADDRESS stuff, you could amend your formula with the parts in red below:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    But if what you're doing are counting the instances of each value in AN4:AN8 that do not fall on weekends then the below entered into cell AO4 and copied down should do the trick.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    You can copy that to subsequent months and amend the reference to column C to suit.
    So Feb would be
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Is any of that of use to you?

    BSB

  10. #10
    Registered User
    Join Date
    07-10-2016
    Location
    ENGLAND
    MS-Off Ver
    365
    Posts
    6

    Re: COUNTIF using current column

    Hi BSB

    Yes that works perfect thanks

    i'm pretty sure i was complicating it it didn't help that i inherited the spreadsheet, its going to be a lot easier now

    Thanks

  11. #11
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: COUNTIF using current column

    You will still need to deal with the bank holidays, but that shouldn't be too onerous.

    Feel free to mark the thread as SOLVED if you're happy you have a working solution

    BSB

  12. #12
    Registered User
    Join Date
    07-10-2016
    Location
    ENGLAND
    MS-Off Ver
    365
    Posts
    6

    Re: COUNTIF using current column

    Yes the bank holidays i calculate separately, be nice to add them twice if there was some marker on that cell or if the formatting was a set way is that possible way.

    When i can work it out i'll mark it a solved as this is really a separate question

  13. #13
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: COUNTIF using current column

    You could just set up some cells to sum the bank holiday values for each month then subtract those from the relevant monthly totals.
    Not sure what I mean by that it clear. Have to disappear shortly but will be back later and will try to put together something to demonstrate.

    Your data layout doesn't make this a simple process for subsequent years to be automated I'm afraid. Certainly not without VBA.

    BSB

+ 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] Set PivotTable Filter to Current Day, Current Week, Current Month, or Current Year
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2014, 08:31 AM
  2. [SOLVED] Modifying current COUNTIF Function
    By zaikun335 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-28-2014, 10:45 PM
  3. [SOLVED] CountIF by Month in current year
    By chatnet26 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-07-2014, 11:58 PM
  4. [SOLVED] Countif or sumproduct for current week
    By acecalder in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-13-2013, 02:40 PM
  5. countif current month excel 2007
    By acecalder in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-06-2013, 03:14 PM
  6. Formula needed for COUNTIF in current month
    By atomickitty in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-02-2012, 03:00 PM
  7. COUNTIF and relative offsets from current cells
    By mikejc in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-16-2011, 04:08 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