+ Reply to Thread
Results 1 to 8 of 8

Countif with Merged Cells

Hybrid View

  1. #1
    Registered User
    Join Date
    09-05-2008
    Location
    RSA
    Posts
    39

    Countif with Merged Cells

    Hi all

    As said I have spent three days trying to figure this out and have still not got any closer!

    Here is the spreadsheet I am working with:

    Example1.zip

    I need a formula that will tell me how many times "John" does sales after the 2nd Sep. I.e. on the 3rd to the 7th.

    I have tried a countif and sumif combination, but the merged cells cause problems. Please advise.

    Many Many Thanks!

    Alex
    Last edited by Alexander_Read; 09-05-2008 at 07:42 AM.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Please take a couple of minutes and read the Forum Rules then edit your thread title by following the instructions in the rules (Rule 1) so that it better discribes your problem/request
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    09-01-2008
    Location
    Houston, TX
    Posts
    70
    Alex,

    This is one possible solution. I created a named range "John" with the formula below. Cell N1 contains a date. Cell L2 contains the formula =COUNTIF(John,"Sales") and will return the number of cells under John after the date entered in Cell N1.

    =OFFSET(INDIRECT("I"&MATCH(Sheet1!$N$1+1,Sheet1!$B$1:$B$30,0)),0,0,COUNTA(Sheet1!$I:$I),1)

    Example1.xls

    Hopefully this will be useful.

    Gary

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Alex,
    best thing to do is to get rid of merged cells !
    Use them for eyecandy or to make your sheets look good, but avoid them at all costs if you want to use them for any analyze.
    To have the same effect try format -alignment - select position horizontal and "center across selection".
    This will look the same and save you lots of headaches.
    Cheers

  5. #5
    Registered User
    Join Date
    09-01-2008
    Location
    Houston, TX
    Posts
    70

    Another option

    Alex,

    Arthur's post is right on...get rid of the merged cells if you can. But if you prefer to keep this here is an easier way than my previous post.

    Use a cell somewhere to contain the "count after" date (I used $N$1 in this formula) and then enter this formula wherever you want the count to display.

    =COUNTIF(INDIRECT("I"&MATCH($N$1+1,$B$1:$B$30,0)&":I30"),"Sales")

    Don't know why I didn't think of this yesterday.

    Good luck,
    Gary

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Quote Originally Posted by arthubr
    best thing to do is to get rid of merged cells!
    I think we are unanimous.

  7. #7
    Registered User
    Join Date
    09-05-2008
    Location
    RSA
    Posts
    39

    Merged Cells

    Hi

    Thanks for the input. I will be using those formualae today!

    Yes, I agree merged cells are a headache, but sometimes I require them for aesthetic purposes.

    I tried the center across selection, but can't get the same effect as a merged cell. It only seems to work with a horizontal selection? How do I achieve the merged effect with a vertical selection?

    Regards

    Alex

  8. #8
    Registered User
    Join Date
    09-05-2008
    Location
    RSA
    Posts
    39

    Match Formula

    Hi Gary,

    Thanks for the great formula!

    I am working on my Excel skills but sometimes you can’t work out a formula and fresh input helps! You also get to learn some neat new tricks!

    The formula you gave is perfect! I just need to tweak it.

    1) I want to be able to specify a person. I have put a little table together to show you. (I have used a match function to identify “John” as being in column 9, but I’m not sure how to convert 9 to “I”, without doing another table and lookup) (I almost need an inverse of the columns function)

    Example1.zip

    2) I want to check the dates across the sheets and between two dates. I.e. between the 2nd Sep & 11th Sep in sheets “Week 1” and “Week 2”. (I have five sheets but have only included 2 in the sample)

    Regards

    Alex

+ 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. figure how many days left in a month if a date is given
    By associates in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2008, 12:10 AM
  2. Replies: 1
    Last Post: 09-04-2007, 07:42 AM
  3. Replies: 16
    Last Post: 03-27-2007, 02:14 AM
  4. Counting days worked and Averaging Totals
    By lilbpaw in forum Excel General
    Replies: 16
    Last Post: 11-21-2006, 04:38 PM
  5. Spent days with this one
    By skyeler in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-20-2006, 11:16 AM

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