+ Reply to Thread
Results 1 to 7 of 7

Conditional fomatting based on AND(), INDEX() and MATCH() function?

  1. #1
    Registered User
    Join Date
    10-02-2012
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Conditional fomatting based on AND(), INDEX() and MATCH() function?

    I have two spreadsheets with named tables.

    The first spreadsheet is named Components, and the table name is also Components
    Some of the headers are Art.no and PAH


    In my second spreadsheet I have another table linking some of the infomation from those components.

    Here I want to do some conditional formatting in column P.

    The formula I'm trying to use (and combinations of it) is:
    Please Login or Register  to view this content.
    Basically I want to see if the PAH-column in components is yes AND P1,P2,P3,... is empty.
    It matches the spreadsheets Art.no-column with the same column in the Components-spreadsheet.

    But it doesn't work, it always gives me the error-message:
    The formula you typed in contains an error.

    I tried to foolproof the formula with a standard IF()-formula in an empty cell and then it works with a correct result
    Please Login or Register  to view this content.

    What is wrong with the same formula using Conditional formatting?

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Conditional fomatting based on AND(), INDEX() and MATCH() function?

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Conditional fomatting based on AND(), INDEX() and MATCH() function?

    Hello,

    copy the formula into a worksheet cell and troubleshoot it there. Here you will get more pointers to what is wrong.

    cheers, teylyn

  4. #4
    Registered User
    Join Date
    10-02-2012
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Conditional fomatting based on AND(), INDEX() and MATCH() function?

    Hi

    Enclosed is an example worksheet.

    I have copypasted many columns without doing any proper conditional formatting.
    Please only focus on the P-column in the spreadheet Component-per-supplier and D-column (PAH) in Components-spreadsheet.

    My first plan was to have the requirement (yes/no) in the O-column in Component-per-supplier.
    This is why I have a format on P4 with the rule =AND(O1="Ja";P1="")

    But as I can have the same item several times (row 4 and 10 in the example file), I want to look at the component-specific requirement from the Component-sheet instead.

    This is why I would like to change the format rule to
    =AND(INDEX(Components[PAH];MATCH([@[Art.no]];Components[Art.no];0))="Ja";P1="")

    Hope this explains the problem
    Attached Files Attached Files

  5. #5
    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
    52,942

    Re: Conditional fomatting based on AND(), INDEX() and MATCH() function?

    The formula you are using...
    =IF(AND(INDEX(Components!$D$3:$D$8,MATCH($G4,Components!$A$3:$A$8,0))="Ja",P4=""),"true","false")
    seems to be working OK? There is only 1 entry on Components that meets the criteria, so 456 is all that will return TRUE

    You dont need the IF statement there anyway, you are looking for a TRUE/FALSE answer, and that is exactly what this will give you...
    =AND(INDEX(Components!$D$3:$D$8,MATCH($G4,Components!$A$3:$A$8,0))="Ja",P4="")
    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

  6. #6
    Registered User
    Join Date
    10-02-2012
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Conditional fomatting based on AND(), INDEX() and MATCH() function?

    Hi FDibbins,

    Well, I didn't use the IF-formula to do formatting, just had it for foolproofing.

    Thank you, it seems to work (after changing commas to semicolons).

    But the problem with that formula is that it is locked to row 8 in the Components-sheet.

    If I insert a new row in the middle it adjusts the coditional formatting to row 9.

    But if I go to the last row, enter new information so it becomes part of the table, then conditional formatting-formula doesn't recognize the new row.

    This is why I would prefer to use Components[Art.no] instead of Components!$A$3:$A$8

    If it's not possible to refer to tables in conditional formatting, maybe I need to refer to row 5000 or something like that, but I'd like to avoid that..

  7. #7
    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
    52,942

    Re: Conditional fomatting based on AND(), INDEX() and MATCH() function?

    I dont like the structured table references, so I just convert back to range. I see no reason why CF should not work on table references. If you set the range correctly in the Applies To" windiw, the CF should be applied to any inserted rows.

    On a side note, you already have a bunch of CF rules there maybe some of tghose are conflicting? And some do not have a range for Applies To?

+ 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. Help using index match function to lookup value based on requirements
    By satcess in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-22-2015, 09:13 PM
  2. Simple solution. Criteria based conditional formatting. (Index match) HELP!
    By omni13 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-18-2013, 12:11 PM
  3. [SOLVED] Conditional formatting based on VLOOKUP/INDEX:MATCH
    By strud in forum Excel General
    Replies: 2
    Last Post: 06-13-2013, 07:02 AM
  4. Conditional Formatting with Index/Match function
    By zhopa19 in forum Excel General
    Replies: 5
    Last Post: 10-04-2011, 04:57 AM
  5. Conditional Fomatting formula
    By loner2003 in forum Excel General
    Replies: 2
    Last Post: 09-15-2010, 09:26 AM
  6. Conditional Fomatting >3 in code
    By Nuttychick in forum Excel General
    Replies: 3
    Last Post: 06-02-2006, 12:50 PM
  7. conditional fomatting
    By Jock W in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-28-2006, 07:50 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