Replicating conditional formatting in Excel - excel

I'm having trouble using Conditional Formatting in Excel. No problem with setup for one row, but no luck replicating it to the rest of the worksheet.
A B C D
1 MATCH_RESULT CODE DESCRIPTION CHECKUP
2 #N/A A1 Chair #N/A
3 #N/A B1 Window #N/A
4 2 C1 Table #N/A
The goal is to identify if column A is filled with value #N/A (default error message for MATCH function). If it is, cells in columns - A, B, C - ONLY ON THE SAME ROW should be formatted (with color red). I.e. as per example, A2:C3 should be formatted.
This is working for me, however just for the first row and I fail to correctly replicate this downwards.
I'm selecting A2:C2 -> Conditional Formatting -> New Rule -> Use a formula to determine which cells to format.
I will end up with the formatting setup such as:
Formula: =$A$2=$D$2
Applies to: =$A$2:$C$2
A2 through C2 will be formatted, as expected (due to A2=D2). However I can't replicate the same thing on next rows. Format painter function will expand the current functionality so that still A2=D2 match is looked at for formatting other rows, instead of A3=D3 and so on.
Pretty sure the key is in $, but nothing has worked yet. Also pretty sure Excel allows just one cell in column D to be populated with value #N/A for comparison.

You have three issues, first your range is (part of) a single row =$A$2:$C$2. Try selecting ColumnsA:C before adding the rule, or change Applies to to:
=$A:$C
Second, you have anchored the row references in your formula. The 'style' should be:
=$A1=$D1
However your third issue is that comparing errors (#N/A resulting from a function) returns ... #N/A (so I don't know how you managed to get even a single row to work, since CF needs a TRUE result to trigger).
Maybe try:
=AND(ISNA($A1),ISNA($D1))

Replace the formula part with
=iserror($A2)
you may need to remove the $ manually.

Related

Problem extracting data from a cell populated from a formula

I imported a txt document which creates 7 columns of data. One of the data points in the document is a MAC address, however, due to the format of the txt document (and there is no way around this), the MAC address is split up into 6 columns (B-G), with all other pertinent data (non MAC addresses) existing in column B.
I am trying to write a formula to check a cell in column B, and if it contains "BSSID" then it will combine the text in the corresponding row from columns B-G and enters the new value in column H (so it shows as a normal MAC address). If the cell does not contain "BSSID", then the value of that cell just needs to be moved to the corresponding row in column H.
MY PROBLEM IS given the formula below, if the cell contains "BSSID", the corresponding row in column H will only display the value of the cell in the first column, instead of all the columns.
I have tried taking the code, that combines cells in B-G within the formula, and surrounding it in brackets and quotations, with no luck.
I also tried making this a multiple step solution by only running the formula to combine everything in column H, and then in column I, via a formula.
I tried to move the value returned in column H to column I, but I run into the same issue.
And I have tried swapping the return values, just to make sure, I didn't mix up the true return with the false return.
Original Code I would like to get to work:
=IF(ISNUMBER(SEARCH(“BSSID”,A2)),B2&":"&C2&":"&D2&":"&E2&":"&F2&":"&G2,B2)
This is what the code looked like, when I broke it into 2 parts:
Column H: =B2&":"&C2&":"&D2&":"&E2&":"&F2&":"&G2, B2
Column I: =IF(ISNUMBER(SEARCH(“BSSID”,A2)),H2,B2)
Both codes only return the value in cell B2 if true, instead of what should look like a MAC address.
My expected results would be, in a single formula, if B2 contains the string "BSSID" that H2 would show the content of B2-G2 formatted to look like a MAC address; and if B2 does not contain the string "BSSID" then H2 will show the content of B2.
Actual result is that H2, when the formula returns true, only displays B2 and not B2-G2.
I would approach this problem as follows:
Check the cell for BSSID using an IF statement =IF(SEARCH("BSSID",A2), <true>, <false>)
This statement may result in an error though, if "BSSID" isn't found. Your code looks to be fine, but perhaps herein lies the issue. To be sure, we can insert a catch for the errors using IFERROR =IF(IFERROR(SEARCH("BSSID",A2), FALSE), <true>, <false>)
Then, within the <true> section of the IF statement, I would use TEXTJOIN to combine my cells with a colon inbetween ...TEXTJOIN(":",TRUE,B2:G2)...
EDIT: I notice that you say in one location that you are checking cell A2 for "BSSID" and in another you say you are checking cell B2. Perhaps make sure you aren't checking the wrong cell?
=IF(ISNUMBER(SEARCH(“BSSID”,A2)),B2&":"&C2&":"&D2&":"&E2&":"&F2&":"&G2,B2)
...
My expected results would be, in a single formula, if B2 contains the string "BSSID" that H2 would ...

Conditional Formatting using multiple vlookups

I have an excel spreadsheet and I am trying to do conditional formatting based on multiple conditions. I have to highlight the rows where (Column A value matches column C) AND (Column B matches column D). I tried 3 ways but none of them are giving me expected results-
Method 1 - I tried conditional formatting with these 2 Rules-
(VLOOKUP($A2,C2:C93,1,FALSE))>0
(VLOOKUP($B2,D2:D93,1,FALSE))>0
and applied it to $A$2:$D$5745
but this is not working as expected.
Method 2- I tried using if but this is also not providing me desired results
=if(VLOOKUP(A2,$C2:$C93,1,FALSE)>0 & VLOOKUP(B2,$D2:$D93,1,FALSE),True,False)>0
applied it to $A$2:$D$5745
Method 3- =AND((VLOOKUP($A2,C2:C93,1,FALSE))>0,(VLOOKUP($B2,D2:D93,1,FALSE))>0)
applied it to $A$2:$D$5745
To rephrase this problem- I would like to highlight all rows where CustEID in Col A and Account EID in cloumn B match CustEID in col C and Account EID in col D.
Can someone please guide me?
Here's what I was able to get working.
The VLOOKUP evaluates to return either the "found" value or #N/A. By modifying your formula with a logical check >0, this converts the result to a boolean value (TRUE) but only in the case where VLOOKUP is returning a valid value. In many of your cases, your formula still evaluates to #N/A.
So this: =VLOOKUP(A2,$C$2:$C$93,1,FALSE)>0 will return either TRUE or #N/A.
I've modified the formula to =IFNA(VLOOKUP(A2,$C$2:$C$93,1,FALSE)>0,FALSE), which forces the entire formula to return a true boolean value TRUE or FALSE.
The cell range references in your formulas need to be locked into specific ranges that will not be evaluated as "relative" in the context of the conditional format formula. So your formula VLOOKUP($A2,C2:C93,1,FALSE) using the range C2:C93 will also "slide" (my own terminology for this formula going "relative") as it progresses down the rows. So each of your formulas needs to lock this down with VLOOKUP($A2,$C$2:$C$93,1,FALSE).
Notice that the only portion of the formula that stays relative is the row number -- the 2 in this case. So you'll start your conditional format setup on row 2.
Combining these formulas for the full test you want to apply gets you
=AND(IFNA(VLOOKUP($A2,$C$2:$C$93,1,FALSE)>0,FALSE),IFNA(VLOOKUP($B2,$D$2:$D$93,1,FALSE)>0,FALSE))
Applying this to your conditional format as a full row requires one last adjustment. Instead of applying your rule to the range $A$2:$D$5745, you have to remove the column references. So the application range becomes $2:$5745.
This is what I get when it's all put together:

Excel Index to look up multiple values

I have a small data set of 2 columns and several rows (columns A and B)
I want to return each instance of codeblk 3 in a formula that is elsewhere in my sheet, (so a vlookup is out as it only shows the first instance) if it does not appear then a message to say its not there should come up.
I have the formula partially working but i cant see the reason why its not displaying the values.
My formula is as below:
This is an array
{=IF(ISERROR(INDEX($A$55:$B$70,SMALL(IF($B$55:$B$70=3,ROW($B$55:$B$70)),ROW(1:1))-1,1)),"No value's produced",INDEX($A$2:$C$7,SMALL(IF($B$55:$B$70=3,ROW($B$55:$B$70)),ROW(1:1))-1,1))}
The result that shows up is only "No values produced" but it should reflect statement B, C and D in 3 separate cells (when changing ROW(1:1), ROW(2:2) etc)
{=SMALL(IF($B$56:$B$69=4,ROW($B$56:$B$69)),ROW(1:1))} - This produces the result 68 which is the correct row.
Any ideas?
Thanks,
This is an array formula - Validate the formula with Ctrl+Shift+Enter while still in the formula bar
=IFERROR(INDEX($A$55:$B$70,SMALL(IF($B$55:$B$70=3,ROW($B$55:$B$70)-54),ROW(1:1)),1),"No value's produced")
The issue you are facing is that your index starts it's first row on $B$55, you need to offset the row numbers in the array to reflect this. For example, the INDEX contains 16 rows but if you had a match on the first row you are asking for the 55th row from that INDEX(), it just can't fulfil that.
EDIT
The offset was out of sync as your original formula included another -1 outside of the IF(), I also left an additional bracket in play (the formula above has now been edited)
The ROW() function will essentially translate $B$55:$B$70 into ROW(55:70) which will produce the array {55;56;57;58;59;60;61;62;63;64;65;66;67;68;69;70} so the offset is needed to translate those row numbers in to the position they represent in the indexed data of INDEX().
The other IF() statement then produces and array of {FALSE;2;3;4;FALSE etc.
You can see these results by highlighting parts of the formula in the formula bar and hitting F9 to calculate.

Excel Formula not accepted but no reason for error

I have a if formula with a number of criterias it has to match.
When I have shortened the formula down it works from beyond - IF(LEFT(A6,1)="2"
but there are no reasons it should error at this point? Any help?
=IF(LEFT(A6,2)="10","Area 1",IF(LEFT(A6,2)="12","Area 2",IF(LEFT(A6,2)="13","Area 3",IF(LEFT(A6,2)="14","Area 4",IF(LEFT(A6,2)="15","Area 5",IF(LEFT(A6,2)="16","Area 6",IF(LEFT(A6,2)="17","Area 7",IF(LEFT(A6,1)="2","Bulk",IF(LEFT(A6,1)="4","Intl",IF(LEFT(A6,2)="7","CGCC","Ad-Hoc"))))))))))
You can try combining IF and VLOOKUP.
=IF(LEFT(A6,1)="4","Intl",IF(ISNA(VLOOKUP(LEFT(A6,2),{"7","CGCC";"10","Area 1";"12","Area 2";"13","Area 3";"14","Area 4";"15","Area 5";"16","Area 6";"17","Area 7"},2,FALSE)),"Ad-Hoc",VLOOKUP(LEFT(A6,2),{"7","CGCC";"10","Area 1";"12","Area 2";"13","Area 3";"14","Area 4";"15","Area 5";"16","Area 6";"17","Area 7"},2,FALSE)))
I embedded the array in the formula but you can prepare a table (assume G1:H7) like this:
and then use the VLOOKUP with the reference:
=IF(LEFT(A6,1)="4","Intl",IF(ISNA(VLOOKUP(LEFT(A6,2),G1:H7,2,FALSE)),"Ad-Hoc",VLOOKUP(LEFT(A6,2),G1:H7,2,FALSE)))
IFNA or IFERROR could also be used but they are not available in Excel 2003.
Your entire formula could be shortened to 2 VLOOKUP functions, by putting your data into a table, with your ID column on, say, column A of sheet2, and your results column on column B of sheet2. This would look as follows:
=IFERROR(VLOOKUP(LEFT(A6,2),'Sheet2'!A:B,2,0),IFERROR(VLOOKUP(LEFT(A6),'Sheet2'!A:B,2,0),"Ad Hoc"))
What this does is: first try to match the left 2 characters in A6 to one of your ID's in column A in sheet2. If that creates an error, it tries to match the left 1 character in A6 to one of your ID's in column A of sheet2. Either way, it returns the matching value in column B of sheet2. If no match is found, it returns "Ad Hoc".

Excel Conditional Formatting, Referencing 2 cells to the Right with conditions

I have a list of students who are between the ages of 3 and 5. lets say column A has the code, Column D has the childs age & Column F has their age group (3-5) If their age exceeds the age group then the Cell in column A will highlight Red. I am just not sure how to write this code correctly, all of the combinations i have tried come up with an error or just don't do anything.
IF(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,7)="3-5" & (OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,4)>5 {THEN FILL CELL RED} {ELSE NO FILL}
In the first part of the statement you are checking whether the cell 7 columns across = "3-5". You don't need to use offset for this, you can just reference the cell 7 across directly.
So if you're applying the conditional formatting to A1 that part of the formula would just be =IF(H1="3-5",{then},{else}).
If you just want TRUE or FALSE as the answer you don't need the IF statement, so this shortens to: =H1="3-5",
If you're applying the conditional formatting to a range instead of just an individual cell, say A1:B10, then you write the formula for the cell in the top left of the that range. So for A1:B10 you would still you the same formulae as above.
For the second part of the statement, using the same logic as above, you get: =E1>5
To check both statements together you need to wrap them in the =AND() function, giving you this as the final formula for your conditional formatting:
=AND(H1="3-5",E1>5)
By using the AND function I can achieve the desired result without cell references moving if a cell is relocated.
=AND(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,7)="3-5yo",OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),0,4)>5)

Resources