Conditional formatting for multiple rows (highlight lowest value in each) - excel

I have a table in a sheet in Excel with over 2000 rows and about 500 columns of data (numbers). Values in a particular column header are being compared to each row underneath that header, and I am using a VBA function to calculate these values (in other words, I am comparing the value in B1 to the values in A2 through A2146, the value in C1 to the same range, etc). I want to highlight the lowest number in each row by filling the cell. I have researched this issue and tried to solve the problem by implementing this solution, but by using MIN instead of MAX:
=A1=MIN($A1:$TX1)
Columns A through TX contain data.
However, when I use this function as a formatting rule, Excel highlights the wrong values and sometimes multiple values in a row. For example, I have a row with a cell containing the value 10.2, which is the only cell highlighted in this row, even though it is neither the MIN nor MAX of the specified row. Additionally, I have another row which contains values 10.6, 8.4, 5.2, and 20.8. Each one of these values is highlighted based on the formatting rule above, though 5.2 is the obvious MIN; the other three cells with the aforementioned values, then, should not be formatted.
How can I remedy this? I have tried adjusting relative/absolute cell references to determine if this could be the problem, but I am quite sure that the way I'm referencing the cells is correct.

Courtesy #barry houdini (copied from a Comment):
Select the whole range of numbers B2:TX2146 (you can do that by typing that range in the box above A1 then press RETURN). Now set CF with the formula that applies to top left cell, i.e. =B2=MIN($B2:$TX2)

Related

Conditional formatting of variable size table, based on values in array

I have a table B2:H9 and I'm trying to highlight the cells that match the values in column K2:K9
see sample 1
I can do conditional formatting in B2:H9 cells by using the EQUAL TO option - I select one cell in the column K2:K9 at a time, so I have to repeat the process 8 times.see sample 2
The problem I am running into is that both the table B2:H9 and the reference column K2:K9 will change size (sometimes will be 1000 rows or more) and it's impossible to repeat this task so many times.
Is there a faster way to do this? I tried the option "Use a formula to determine which cells to format" but had no luck - it seems to only work for individual cells but not for the full column K2:K9
Thanks!
you can do the following:
select B2
set conditional formatting as =B2=$K2, press OK
in the Applies to section extend the range from B2 to B2:H9
as for B2 there is no $ it should change dynamically for both rows and columns, and for $K2 only row should change

Excel - Double press of the Fill Handle is filling to the end of column, not the end of adjacent dataset

Summary:
I am currently trying to fill a formula to a whole column in Excel to the end of an adjacent dataset (A2:A14500). Instead of the usual behaviour where Excel will flash-fill it to the end of the dataset in the adjacent column B2:B14500 for example, it instead flash fills it to the whole column (B2:B1048576), even past the end of the dataset in column A.
Use Case:
Column A is just a =FILTER command to pull from another sheet, excluding the blanks (in my live sheet, cell A1 is =FILTER('Raw'!A:A,'Raw'!A:A<>""). All other columns contain headers in cell 1:1. Cell B2 contains a basic 2 part =IF statement with an error catchall: =IF(ISERROR(VLOOKUP(A2,'Lookup'!A:B,2,FALSE)),"No",IF(VLOOKUP(A2,'Lookup'!A:B,2,FALSE)="Error","Yes","No"))
In my current example, the =FILTER in column A produces 14500 rows of data. I am attempting to use the fill handle to populate B3:B14500 with the =IF statement currently in cell B2. When I double press the fill handle, it fills the whole column of B3:B1048576, which causes Excel to crash (I am trying to do the same for 32 columns (B2:AG14500), so it is flash-filling over 33 million formulas instead of 600K).
Expected result when double clicking flash handle in formula column:
Data
Formula
1
Yes
2
Yes
3
No
4
Yes
Actual current result when double clicking flash handle in formula column:
Data
Formula
1
Yes
2
Yes
3
No
4
Yes
No
No
No
No
No
Final Comment:
Usually, when double pressing the fill handle on a formula in column B, I'd expect it to match the end of the dataset in column A (If column A contains data in cells A2:A100, I'd expect double pressing a formula in cell B2 to copy that formula to B2:B100, not B2:B1048576).
I know that copy-pasting is an option, as is manually dragging the fill handle down, but this involves me using weird Ctrl/Shift/Arrowkey combos to select the right range (this is supposed to be user friendly by others who don't use Excel much), or a long time holding the fill handle as there's 14K rows of data. Additionally, I am aware of Home>Fill>Down and Data>Flash Fill but neither of these work for me (Fill Down replaces the formula in B2 with the header in B1 and only copies down to B2, and Flash Fill tells me it can't see a pattern, despite providing it 1/2/5/10 cells of example data).
Any assistance with understanding why the double-click fill handle isn't working (I suspect it's due to the way it handles the =FILTER in column A), or how to overcome this would be appreciated. Currently using MSO365. Thanks!
PS. The reason I haven't filled the formulas manually is the number of cells in column A will change for each report generated with this spreadsheet, so the number of cells it needs to populate will vary.
=IF(ISERROR(VLOOKUP(A2#,'Lookup'!A:B,2,FALSE)),"No",IF(VLOOKUP(A2#,'Lookup'!A:B,2,FALSE)="Error","Yes","No"))
Adding # to the cell range that results in the spill will reference the whole spill. In case of lookup it'll spill the result of the lookups from the first to the last of the cells from the spill range.
PS since you own Office 365 you might want to look into XLOOKUP instead of VLOOKUP. XLOOKUP already has an embedded value if not found.

How to define excel SUMIFS criteria considering any text and numbers?

My SUMIFS formula criteria is based on a cell (say A1) that is data validated by list and changed via selection by user. If cell has data inside text or number by selection from drop down list, SUMIFS formula is considering that data as criteria to calculate the related sum. If criteria cell is left blank, I want formula to sum everything without any condition. My problem here; in criteria field of SUMIFS formula, I typed if condition like; SUMIFS(sum-range,criteria_range,IF(A1<>"",A1,"*")) but in this case excel considers only text values and do not include cells containing number. Briefly, if nothing selected in A1, I want SUMIFS formula to sum everything without any condition, numbers, texts and even blank cells. How can we proceed to do that?
EDIT:
Here an example for data and formula, what is expected is actually to disable criteria if one of selection is blank on left. Harun's suggestion works but if there is blank cell in criteria range, then in this case it won't consider those values in sum. For instance, if we select from left Phone/smart/touch, then how can we get "2" as output no matter what is in cri_range4 cells? Thanks
Example:
How about this solution? It basically ignores a missing entry in column C and evaluates only the other two. (Your example formula has a fourth criterium that isn't apparent in your list but the method can be extended for as many criteria as you might have.
=SUMPRODUCT((IF(LEN(C2),(INDEX(Lists,,1)=C2),TRUE))*(IF(LEN(C3),(INDEX(Lists,,2)=C3),TRUE))*(IF(LEN(C4),(INDEX(Lists,,3)=C4),TRUE))*SumRange)
For better readability I created a named range Lists which comprises your sample range E2:H10 while I named I2:I10 as SumRange'. INDEX(Lists,,1}` refers to the first column of the range. It's important that SumRange and Lists have the same number of rows.
If A1 is blank then just use not equal operator to sum all cells that are not blank. Try below.
=SUMIFS(D1:D5,C1:C5,IF(A1<>"",A1,"<>"))
Edit: can you check below formula in D3 cell then drag down.
=IF(C2="",SUM($I$2:$I$10),SUMPRODUCT(($E$2:$H$10=C2)*($I$2:$I$10)))

Set countif / countifs range to ONLY the last row in a range

I am trying to find the number of times a certain text string appears on the last inspection of a vehicle. The columns are areas to check, and each inspection is on a separate row. The range is D6:VG150 (the 150 is to allow for future inspections). The majority of cells are blank, either because I haven't used that row yet, or there was no fault found in that area during a previous inspection. The only column that will be filled is column A, which has the dates of inspection. I ONLY want results from the last inspection (to indicate current status on a fleet status worksheet). Even better would be to check the last filled cell in every column in that range, but that might be pushing it.
I have tried =COUNTIF(INDIRECT("'291'!$D$6:$VG"&INDEX(MAX((A:A<>"")*(ROW(A:A))),1)),"Schedule Repair"), but it returned the results from the entire range defined by the last range. I tried switching the first address of the range, $D$6, to $D&, but this returned a #REF! error.
I've tried to simplify your scenario. The screenshot below shows a table that starts in row 3 and extends to row 7. The formula counts how many cells in the last row of the table have the text "a". The formula is
=COUNTIF(INDEX(A:A,COUNTA(A:A)+2):INDEX(C:C,COUNTA(A:A)+2),"a")
You don't need Indirec. Index is a lot better. The first Index returns the cell A7. The second Index returns the cell C7. Using the colon as the operator will turn the two cells into a range that can then be used by Countif.
The last row is identified by counting all cells with text in column A, and then adjusting for the fact that there are empty rows above the table.
Oh, and by the way, if you use an Excel Table, you don't need to pre-fill formulas into empty rows. In an Excel Table all formulas are automatically applied to new rows.

(Excel) Conditional Formatting based on Adjacent Cell Value

I'm trying to apply conditional formatting in Excel on a range of cells, based on the adjacent cell's value, to achieve something like this:
The goal is to highlight values in Column B (Actual Expense) red if the value is greater than it's adjacent value in column C (Expected Expense). I've followed a number of tutorials that said to apply conditional formatting by selecting Conditional Formatting>New Rules>Use a Formula to Determine Which Cells to Format then applying a rule =$B4>$C4 which would format the 'Actual' cell red if it were greater than the 'Expected' cell. This works great for one cell, but not so well when I attempt to apply this to a range of cells. I've used the format painter as well as editing the rule to be applied over a range of cells (i.e. $B$2:$B$5) as shown below but it only bases the formatting on the initial formula (if B4 is greater than C4) and everything undesirably turns red.
I'd rather not make individual rules for every row. Is there a way to consolidate this into one rule?
You need to take out the $ signs before the row numbers in the formula....and the row number used in the formula should correspond to the first row of data, so if you are applying this to the ("applies to") range $B$2:$B$5 it must be this formula
=$B2>$C2
by using that "relative" version rather than your "absolute" one Excel (implicitly) adjusts the formula for each row in the range, as if you were copying the formula down
I don't know if maybe it's a difference in Excel version but this question is 6 years old and the accepted answer didn't help me so this is what I figured out:
Under Conditional Formatting > Manage Rules:
Make a new rule with "Use a formula to determine which cells to format"
Make your rule, but put a dollar sign only in front of the letter: $A2<$B2
Under "Applies to", Manually select the second column (It would not work for me if I changed the value in the box, it just kept snapping back to what was already there), so it looks like $B$2:$B$100 (assuming you have 100 rows)
This worked for me in Excel 2016.

Resources