+ Reply to Thread
Results 1 to 6 of 6

IF, AND, COUNTIF Functions

  1. #1
    Registered User
    Join Date
    12-14-2015
    Location
    Indianapolis, Indiana
    MS-Off Ver
    2010
    Posts
    3

    Question IF, AND, COUNTIF Functions

    Hello-

    I'm trying to set up a print sheet that will return the information that matches two criteria and display it without the blank lines from data that doesn't match the criteria. I found a formula I think would work if I could just figure out how to nest the AND function correctly. See the Panda picture comment for the example I used here: http://www.excelforum.com/excel-work...-function.html.

    I've attached my example data and attempts at a print page here: PJ Example for Testing print page.xlsx. Included are both my original IF with nested AND function which returned the correct data with blank lines, and my attempt at the more complex COUNTIF function from the example attached above.

    If someone could help me figure out what's going wrong with my formula, I'd appreciate it!
    Last edited by bruby386; 12-21-2015 at 03:42 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: IF, AND, COUNTIF Functions

    You did not really say what your criteria are?

    From the formula, it looks like 1 of them is week no and the other is Dept? If so, try this ARRAY formula...
    A2=IFERROR(INDEX('Purchase Journal'!$A:$N,SMALL(IF(('Purchase Journal'!$B$2:$B$10="week 1")*('Purchase Journal'!$A$2:$A$10=12210),ROW('Purchase Journal'!$A$2:$A$10)),ROWS($A$1:A1)),MATCH(A$1,'Purchase Journal'!$A$1:$O$1,0)),"")
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Then copy down and across...and format...as needed
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    12-14-2015
    Location
    Indianapolis, Indiana
    MS-Off Ver
    2010
    Posts
    3

    Re: IF, AND, COUNTIF Functions

    Thank you so much, your suggestion worked perfectly!

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: IF, AND, COUNTIF Functions

    Happy to help

  5. #5
    Registered User
    Join Date
    12-14-2015
    Location
    Indianapolis, Indiana
    MS-Off Ver
    2010
    Posts
    3

    Re: IF, AND, COUNTIF Functions

    After testing, it doesn't actually appear to do what I need it to do. I'm trying to avoid having to set up a table like the first one in my example file, and just have the formula go hunting through the main data set to return values. Otherwise I have to set up an additional tab just to create the table with the blank lines. There appears to be in the solution previously suggested a MATCH function that matches the information from the full data set to the first example of my two. I was just providing the two examples I had tried separately, not trying to use one to get to the other.

    Is it even possible to do the what I'm trying to do? I'm looking for something that does both - hunting for the correct information via 2 criteria, and displaying it without the blank lines? Thanks!

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: IF, AND, COUNTIF Functions

    I am a little confused My formula creates the table that you want (per my understanding of what you asked), there is no need for a 2nd table.

    Did you use CRTL SHIFT ERNTER to enter the formula, and not just ENTER? Below is your table. with my formula, copied down and across...
    A
    B
    C
    D
    E
    F
    G
    2
    11/2/2015
    11/2/2015
    1/1/1913
    TFD
    2/5/1900
    1/0/1900
    YES
    3
    11/2/2015
    11/2/2015
    9/6/5884
    TFD
    1/0/1900
    1/10/1900
    YES
    4
    11/2/2015
    11/2/2015
    4/23/2347
    TFD
    2/16/1900
    1/0/1900
    YES
    5
    11/2/2015
    11/2/2015
    1/10/1900
    TFD
    2/24/1900
    1/0/1900
    YES
    6
    7


    If this is not what ypou wanted, please upload another file, showing some dummy dada and dummy outputs?

+ 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. VLOOKUP and IF functions or COUNTIF and AND functions?
    By MHayward in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-02-2015, 11:11 AM
  2. [SOLVED] Countif by 2 functions
    By Locopete99 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-12-2013, 05:16 AM
  3. Using COUNTIF and AND functions together
    By Twinkle17 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-18-2006, 04:40 AM
  4. [SOLVED] countif functions
    By bsantona in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-18-2005, 10:50 PM
  5. [SOLVED] COUNTIF / AND functions
    By brianwakin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-15-2005, 06:10 PM
  6. Countif's and And functions
    By Danielle in forum Excel General
    Replies: 2
    Last Post: 10-13-2005, 04:05 PM
  7. COUNTIF functions
    By danowynn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-04-2005, 06:06 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