Index and Match with muliple conditions

Hello Everyone! I hope I can explain what I am trying to do here clearly. This is my first shot:


In the table below "Office Entry Worksheet - Area 1" I am trying to insert a formula in Column B that will result in a "True or False" answer and be used for conditional highlighting


User uploaded file

The first condition that has to be met is that the checkbox in Table "Labor and Material Checklist" Column A must be check, if it is not checked, then move to the next row. If the box is checked, then the next condition would need to index and match column B with Column C of table "Office Entry Worksheet - Area 1". If there is a match in Column C, then move to the next row of column B in the Table "Labor and Material Checklist". Continue this until there is a "no match", then highlight Column B of Table "Office Entry Worksheet - Area 1" in red (or something like "MISSING TASK")


This is an estimate and the idea is to make sure that the Phases that are checkmarked in the table "Labor and Material Checklist" will not be missed when using table "Office Entry Worksheet - Area 1".


Thank you for your help!


Tim

User uploaded file

iMac (27-inch, Late 2012), iOS 7.1.2

Posted on Aug 5, 2016 9:52 PM

Reply
16 replies

Aug 5, 2016 11:33 PM in response to blueTim

Hi Tim,


You wrote:

"In the table below "Office Entry Worksheet - Area 1" I am trying to insert a formula in Column B that will result in a "True or False" answer and be used for conditional highlighting"


As I read this, Column B will contain a series of values that includes only TRUE or FALSE. No other value would appear in any cell in column B.


Conditional Highlighting rules depend on the comparison of the value in a cell with another value either written into the rule, or found in another cell. What cell is to receive the conditional highlighting? What values will that cell hold?


"The first condition that has to be met is that the checkbox in Table "Labor and Material Checklist" Column A must be check, if it is not checked, then move to the next row. If the box is checked, then the next condition would need to index and match column B with Column C of table "Office Entry Worksheet - Area 1". If there is a match in Column C, then move to the next row of column B in the Table "Labor and Material Checklist". Continue this until there is a "no match", then highlight Column B of Table "Office Entry Worksheet - Area 1" in red (or something like "MISSING TASK")"


Formulas do not "move to the next row" dependent on the result of a previous formula. Each formula does its job independently of the others, although its result may depend on the results calculated by other formulas.


I think I have an approximate understanding of what you are trying to accomplish here, but not an exact one.


In the example shown, you have three items checkec in the lower table, "Labor and Material Checklist"

In the upper table, "Area 1..." there is:

  • an empty row (row 2) (why?)
  • The label Area 1 in cell C3, and an 'empty' cell (D3), matching B2 and C2 in the first checked row of the lower table. Are these entered values, or to be constructed by formula?
  • The label "Plans and Permits" in cell C4 and "Project planning...purchasing" (in red) in D4, matching B3 and C3 (disregarding colour) in the second checked row of the lower table. Same questions as above, plus.. Is the colour an example o the conditional highlighting mentioned above? If so, what condition has caused this text to be coloured?
  • A row of empty cells (row 5) despite the presence of a checked box on row 4 of the lower table. Why?


Regards,

Barry

Aug 6, 2016 8:18 AM in response to Barry

Barry,



As I read this, Column B will contain a series of values that includes only TRUE or FALSE. No other value would appear in any cell in column B.

Column B in "Office Entry Worksheet - Area 1" (the top screenshot) is where I was planning on putting the formula that we are trying to put together. The answer to this formula should on be TRUE or FALSE. If I cannot use column B for the conditional highlight as well as the formula, then I can add another column next to the formula column and use it for the conditional highlighting. I would then just "hide" the formula column. I would probably rather do it this way anyway.


So to try and explain better. The "Office Entry Worksheet - Area 1" is for office use only and will not be seen by the customer. This is where each task of each phase is broken down and estimated. You can see the Phase description in red which is an mirror copy of the description of the phase in the lower snapshot. As you can see with Electrical, there are multiple tasks for that phase. The purpose of the formula and conditional highlighting to is make sure that no phase that is "check marked" on Table "Labor and Material Checklist" (lower screenshot) is forgotten. In my mind, the formula that we are working on will be replicated in each cell in Column B. The conditional highlight cells would be "red" if a check marked phase on Table "Labor and Material Checklist" is not matched in Column D of the "Office Entry Worksheet - Area 1". The key is that I am only interested in the check marked Phases on Table "Labor and Material Checklist".


User uploaded file


User uploaded file

The screenshot above is an example of the conditional highlighting of "red" being activated because not all the phases that are check marked on the "Labor and Material Checklist" (top screen shot) Column B are not seen in Column D of the "Office Entry Worksheet - Area 1" (lower screen shot). The conditional highlighting will go to blank once all the selected phases on the top screen shot Column B are "seen" at least once on the lower screen shot Column D.


I hope this helps. I may sound complicated, but I think the formula will be relatively simple. In my mind, this is a index and match formula with 2 criteria?

Aug 6, 2016 10:57 AM in response to blueTim

The purpose of the formula and conditional highlighting to is make sure that no phase that is "check marked" on Table "Labor and Material Checklist" (lower screenshot) is forgotten.


Would something like this work to achieve that purpose?


User uploaded file


I put the check in the first table instead. The formula in D2 of my example, filled down the column, is:


=IF(AND(A2=TRUE,COUNTIFS(Worksheet::B,B)<1),"missing","")


If the checkbox in column A is checked and it counts no occurrences of the contents of column B in column B of the Worksheet table the formula inserts the word "missing." Otherwise, it leaves the cell blank.


I set Conditional Highlighting for the cells in column D like this, turning a the text red if the cell has something in it.


User uploaded file




SG

Aug 6, 2016 11:24 AM in response to SGIII

https://drive.google.com/file/d/0Bwey4EgijH0Od1NEQXhibVBqV3M/view?usp=sharing



Let me know if the above link works. The "missing" formula results must be displayed on the Worksheet, not the Checklist. The Worksheet already has a dropdown menu that has all the values used in Checklist Column B. The reason for this is that there will be multiple entries for a phase such as Electrical as shown below. In other words, there are multiple tasks that need to be estimated to fulfill a phase description.


The Checklist is what the Customer will receive for a project estimate after I have applied the "filter" for the Table. The "filter" hides all the rows that are not check marked.


The Worksheet is for the office and will just be raw data and calculations

User uploaded file

Aug 6, 2016 11:22 PM in response to blueTim

Hi Tim,


Assuming the the Conditional Highlighting is the "red text" in column E of Office Entry..., under what condition does this formatting apply? In the example ALL cells in this column containing text have "red text".


MATCH will find only the first match to its search-for argument. Your example shows three rows with Electrical in column D of Office Entry.... Is this correct?


Formula: Office Entry::B4:

This formula returns a warning: The formula uses a Boolean in place of a number

And an Error: MATCH couldn’t find the value “1”.


Both relate to the use of "1" to mean "TRUE"


=INDEX(Labor and Material Checklist::A:B,MATCH(1,(Labor and Material Checklist::A=TRUE)×(Labor and Material Checklist::B=D),0))


Syntax: INDEX(range, row-index, column-index, area-index)


range: Labor and Material Checklist::A:B --columns A and B of the table named Labor and Material Checklist

row-index: MATCH(1,(Labor and Material Checklist::A=TRUE)×(Labor and Material Checklist::B=D) --result from function. see below.

column-index: 0 --fixed value. Will cause an error. The range being indexed has two columns. Column 1 is column A, column 2 is column B. There is no column zero.

area-index: omitted --as the index applies to a single range, the optional area-index value may be omitted.


Syntax: MATCH(search-for, search-where, matching-method)


search-for: 1 --a numerical value. Will never be found if MATCH is looking in a column containing only Boolean values, or containing only text.

search-where: multiplication statement multiplying Boolean values -- causes the error message shown above.

matching-method: omitted --may be set to 1 (largest value less than or equal to search-for value), 0 (exact-match), or -1 (smallest value greater than or equal to search-for value). If ommited, 1 is assumed.

Even if this multiplication worked, I can't see how the result would tell MATCH where to look for a match to the value 1.


More below.


Regards,

Barry

Aug 6, 2016 11:38 PM in response to blueTim

Part 2:


What is the purpose of the checkboxes in column A of Office Entry...?


If I've read correctly, you want the formula in column B of Office Entry... to return either TRUE or FALSE.

What is to determine this result? What is to happen in the table is the result is TRUE? What is to happen in the table is the result is FALSE?


Column C of Office entry... appears to contain the same pop-up menus as column D of the same table. What is the purpose of this column?


Regards,

Barry


PS: In response to you question above: Yes the link works.

B

Aug 7, 2016 6:19 PM in response to Barry

Barry wrote:


Part 2:


What is the purpose of the checkboxes in column A of Office Entry...?


If I've read correctly, you want the formula in column B of Office Entry... to return either TRUE or FALSE.

What is to determine this result? What is to happen in the table is the result is TRUE? What is to happen in the table is the result is FALSE?


Column C of Office entry... appears to contain the same pop-up menus as column D of the same table. What is the purpose of this column?


Regards,

Barry


PS: In response to you question above: Yes the link works.

B

Barry,


Question 1: Those are used for printing purposes only. They give me the control to print out the rows that I have occupied when I checkmark the boxes.


Question 2: A.) The result is determined by whether a check marked (Checklist) Column B cell data is present (matched) in Column D of Office Entry... For example, if the "Cabinetry" row is check marked in the Checklist Table, then Cabinetry needs to be present in Column D of Office Entry... If it is not present, then the formula would come back as false and the conditional highlight cell would be red. B.) If the formula comes back as TRUE, then it checks the next check marked row in the Checklist Column B. If it goes through the entire column B and all results are TRUE, then the conditional highlight cell would be blank (no color) C.) If the formula comes back as FALSE, the conditional highlight cell becomes red and the formula stops.


Question 3: Please disregard these popups. This is a truncated copy of a larger spreadsheet file. I added this column C to make a visual of what I am trying to do. I did not realize that the popups copied over from Column D. The purpose of Column C would be the Conditional Hightlight cells. The Conditional Hightlight would read like this: "if B4 is FALSE, fill cell red, if B4 is TRUE, then nothing"


The formula in cell B4, Office Entry...Table will be EXACTLY the same as the formula in B5, B6, B7 etc.... All I am trying to do accomplish with having a solid red or blank Column B is for visual purposes. On large estimates, this table could get very long and so having one Conditional Highlight cell at the top would not be seen unless you scrolled to the top of the page. Now this being the case, I could just have the formula that we are trying to create in one cell anywhere in the Office Entry... Table and then have the entire column C Conditional Highlighting be based of the results of the one formula cell. Does this make sense? I only need one formula! I was only going to repeat the same formula for an entire column. Upon more thought, I don't think I will need to do this.


Tim


PS - Just edited this because I was mislabeling my Table in the paragraphs above.

Aug 7, 2016 6:15 PM in response to Barry

Assuming the the Conditional Highlighting is the "red text" in column E of Office Entry..., under what condition does this formatting apply? In the example ALL cells in this column containing text have "red text".

No, the red text of column E is just a copy of the "Phase Description" in the Checklist Table. I just want the text to be red so I know not to touch it. I really wish Apple Numbers had individual cell locking!!



User uploaded file

Aug 8, 2016 1:46 AM in response to blueTim

So the overall purpose is to determine that

  • all the items in column B of ...Checklist
  • that are on rows which have checked boxes in column A of that table,
  • are also listed in column D of Office Entry...,
  • and if they are not, to flood column C of Office Entry... with red.


Note: Office Entry... shows "Electrical" entered on three rows. Is that correct? Will it ever happen? If so, you will need a distinct label for each occurrence.


Question: Assuming one or more of the checked items on ...Checklist were missing from Office Entry..., how would it be known which items this/these was/were?


Here's a possible solution, requiring an additional column (B) on ...Checklist. This column may be hidden.

User uploaded file

Column B contins a formula that creates the index shown—a serial number for each checked box in column A—to be used by VLOOKUP in a formula on Office Entry...


B2, and filled down to the end of column B:

=IF(A,MAX(B$1:B1)+1,"")


Office Entry has two formulas:

User uploaded file

B4, and filled down to the end of column B:

=IF(ROW()−3>MAX(Labor and Material Checklist::$B),"",IF(ISERROR(MATCH(VLOOKUP(ROW()−3,Labor and Material Checklist::$B:$C,2,0),$D,0)),1,0))


The core formula is the part in bold.

The first IF is a switch that checks the maximum value in the index column, and cancels the core formula if the last indexed row has been processed.


Working from the inside outwards, the core formula does this:

  • ROW()-3 returns the current index numbern ad hands it to VLOOKUP
  • VLOOKUP searches for that number in the leftmost column of the lookup table, columns B and C of ...checklist, and returns the value from the same row of column 2 of the lookup table, passing that value to MATCH.
  • MATCH searches for the returned value in column D (of 'this table') and, if it is found, returns a number indicating its position in the list that is column D to ISERROR.
  • ISERROR recognizes the number as a non-error value, and returns FALSE to IF.
  • IF receives FALSE, and returns the 'if FALSE' value, 0, to the cell containing the formula.
  • If MATCH does not find an exact match for the value returned by VLOOKUP, MATCH returns an error message to IFERROR.
  • IFERROR returns TRUE to IF
  • IF receives TRUE and returns the if TRUE value, 1, to the cell containing the formula.


C1 is the key to the conditional highlighting rule for the cells in the rest of column C.


C1: =SUM(B)


As long as every cell in column B contains a zero, or contains a null string, C1 will contain zero. As soon as any cell in column B contains a 1, C1 will contain a value that is greater than zero.


Conditional highlighting rule:


Conditional highlighting rules change the format of the cell containing the rule. The rule compares the value in its cell to a fixed value, or to the value in another cell. All of the cells in column C are empty, which, considered as a number, evaluates as zero.


Each of the cells in column C, starting at C4, has the default fill setting (No fill) as its regular state, and each contains the same rule for conditional highlighting:


If the number in this cell is less than the number in $C$1, fill this cell with red.


If one of the checked rows on ...Checklist is missing from Office Entry..., the result is as shown below:

User uploaded file

Regards,

Barry

Aug 8, 2016 1:00 AM in response to blueTim

Note: Office Entry... shows "Electrical" entered on three rows. Is that correct? Will it ever happen? If so, you will need a distinct label for each occurrence.

Yes, this will happen very often with many of the Phases. You are correct on the distinct label and this is addressed on the far right of the table. See Below....


User uploaded file


Question: Assuming one or more of the checked items on ...Checklist were missing from Office Entry..., how would it be known which items this/these was/were?

You wouldn't know which specific items, but I think it would be sufficient that when your "red column" disappears (or I could possibly make it turn green), the user would know that all the check marked items from Checklist Column B are present (at least once) in Column D of Office Entry...

Aug 8, 2016 12:58 PM in response to blueTim

"That has worked brilliantly!!! "


Except for this detail:


"the user would know that all the check marked items from Checklist Column B are present (at least once) in Column D of Office Entry..."


True, but the "items from column B" and the "items in column D" are just the category names for the phases. If there are three entries in column D,, each for a different set of tasks, but all falling into the same "area/phase" category, as there are for "Electrical" in the example, the formula will not differentiate between all three entries being there, only one entry present, or more than three entries being there.


Is that an issue?


Regards,

Barry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Index and Match with muliple conditions

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.