Format a Column Based on Date and Specific Text - excel

Columns H-AB contain individual dates,
Column A contains text,
Column F contains dates.
I want to conditionally format column H if $A8 says "Project Completion" and H$7 is equal to the date in $F8.
I've really struggled with formatting dependent on multiple variables so I could use some help. When I select the area I want to apply the rule to and test, it formats a single cell in the correct column two rows above my input. Can't figure out why.
EDIT
Thank y'all for the responses, but it seems like maybe my wording wasn't great. What I have so far vs what I want to do. My formula is =and($a8="Project Completion", $f8=h$7)
Thanks again for all the help.

I assume that data is moving down rows. And the format should apply on a row by row basis.
Select Column H (or relevant rows in Column H) and enter this formula:
=AND(A8="Project Completion",$F8=H7)

I am not sure if it is a typo on your question having fixed H$7.
If validation is by row:
=(INDIRECT("A" & ROW()) = "Project Completion")*(INDIRECT("F" & ROW())=INDIRECT("H" & ROW()))
If validation is by row and value on column F is equal to H7:
=(INDIRECT("A" & ROW()) = "Project Completion")*(INDIRECT("F" & ROW())=H$7)
If validation is only for row 8 and F8 is equal to H7:
=($A$8 = "Project Completion")*($F$8 = H$7)

Related

Excel Conditional Formatting with Two Conditions

I am trying to format a row to change color based on the value of the cells at the end of the row. For whatever reason, Excel is forcing the Applies to to contain additional $ and the cells are not highlighting in any logical way.
Here is what I am trying to do:
If Column I = Yes & Column J = Yes -> Row "Fill Color" is Green
If Column I = No & Column J = Yes -> Row "Fill Color" is Orange
If Column I = No & Column J = No -> Row "Fill Color" is Red
The formulas I am using are as follows:
=OR(I$3<>"Yes",J$3<>"Yes") Format: Fill Red Applies to =A$3:D$3
=OR(I$3="No",J$3<>"Yes") Format: Fill Orange Applies to =A$3:D$3
=OR(I$3="Yes",J$3="Yes") Format: Fill Green Applies to =A$3:D$3
Excel keeps changing the Applies to to be =A$3:$D$3 and even though I keeping changing it to =A$:D$3 I can't seem to find why.
Currently, here is the behavior I am seeing:
Column A is Orange and columns B-D are staying Red when I & J are Yes
Columns A-D are Red when and J is No regardless of what column I is
Columns A-D do not turn Green in with any combination
Am I missing something really simple? I can't seem to figure out why it would work this way.
Two things...
$ Sign
I believe the $ behavior you are seeing is normal... The formulas can be relative or absolute cells, but the ranges to which the rules apply should not be and would not have any reason to be.
Logic
I believe your logic problem will be embarrassingly obvious once you step back for a moment and look at your formulas. In your text version of your logic you describe your logical condition as AND(). That is, if I is <> "yes" AND J is <> "yes". But take a look at your formulas.
You didn't enter:
=AND(I$3<>"Yes",J$3<>"Yes")
but rather you entered:
=OR(I$3<>"Yes",J$3<>"Yes")
Change OR to AND and I suspect you are back in business.

Create dynamic search box instead of Ctrl + F

I’d like to create a dynamic search box at the top of my master sheet (Sheet 1) instead of using the “Find” command, Ctrl + F. It would search column B and output info from the corresponding cell in column C.
The search box/cell would be dynamic, so as I type into it, it would pre-populate from a master list (Sheet 2), without having to hit ENTER or an OK button.
I’d like the search box/cell to be in A1
I’d like it to search column B data. From B2 to the end (row can change): B2:B
The result would be the data in column C:C2:C
Not sure if I should use the QUERY or ARRAYFORMULA function. Appreciate any thoughts on how to set this up.
how about this:
=JOIN(CHAR(10), QUERY({B2:C}, "select Col2 where Col1 contains '"&A1&"'", 0))
demo spreadsheet
I think I figured it out!
Sample Sheet
Search Box (A1): I used Data Validation. It is dynamic as I type and lists the master list of items in column A
Search Results (B1): I used VLOOKUP
Thanks, #player0, for suggesting the data validation! Really helped :)
Only issue is that I sometimes have multiple values in Column B (Item). For instance, I have "lemon" listed twice. I'd like the output in B1to show all other results. They can show in B2...Any suggestions?
EDIT: For the issue of multiples in column B, I decided to change all items in Column B to a unique identifier.
paste this in C2 cell:
=QUERY({B2:B}, "where Col1 contains '"&A1&"'", 0)
and set up dropdown data validation from B2:B range in A1 cell
demo spreadsheet

how to the fix the decimals based on another cell decimlas

I have an excel file, i need to do is, format the cell depending on another cell.
If cell "S1" is having 3 decimals cell "T1" should be have the same number of decimals and it is calculated field.
ex:
S1 = 11.123 ---- T1 = 1.099
I need to do for the entire column.
I am able count the number of decimals on the cell by placing the code on worksheet_change. But i have no idea how to format it.
Please help in this regards.
Thanks in advance
Since you wanted an example, here it is :) But please note that this is not an answer. It's just that the comments will not be able to hold all this data plus it will ruin the formatting as well. Having said that, it is almost as good as an answer as it covers almost every aspect of what you want...
My Assumptions:
Data is in Sheet1
Col S and Col T are identical
Logic to achieve what you want
Get the last row of Col S. For example see this
Loop though the cells in Col S and check the number for decimals
Use .Numberformat for format the cells in Col T based on the number of decimals in respective cell in Col S
Few code snippets
Looping Through cells in Col S
For i = 1 To LastRow
If Sheets("Sheet1").Range("S" & i) .... Then
End If
Next i
Setting the number format of cell T in the above loop
'~~> n below is the number of decimal places that you want
Sheets("Sheet1").Range("T" & i).NumberFormat = "0." & String(n, "0")
Incorporate all these and then try to come up with a code. Let use know where you are stuck and we will take it from there.

excel sheet sub headings as columns

I am totally new to this kind of challenges and not sure any thing available ( not sure even on what base I have to search )
In the below excel sheet image the column 'A' has headings in two places ( row numbers 2,3 and 9,10) . The actual excel sheet has more than six thousand rows and too many sub headings like this ( If it is small file I can do it manually.. but more than 6 thousand rows)
The challenge :- I want to populate E column with "Make" value and F column with " Model" from sub headings . Can I write any rule or macro to populate these columns ? could some one help me ? Thanks for your help
Image Link
or below
Regards
Kiran
If you want to do this solely in Excel you can use the following. This assumes
All Headings are the same for "S.No"
Change the SUBSTITUTE clause to match the text for Make and Model eg I have used exact spacing of "Model: " and "Make : " to match the spreadsheet and substitute with ""
In cell G5 Enter =IF(ISNUMBER(A5),IF(ISERROR(FIND("Model",A3,1)),MAX($G$1:G4),MAX($G$1:G4)+1),"")
In cell F5 Enter =SUBSTITUTE(IF(ISNUMBER(A5),INDIRECT(ADDRESS(MATCH($G5,$G:$G,0)-2,COLUMN(A1),1)),""),"Model: ","")
In cell E5 Enter = =SUBSTITUTE(IF(ISNUMBER(A5),INDIRECT(ADDRESS(MATCH($G5,$G:$G,0)-3,COLUMN(A1),1)),""),"Make : ","")
Then drag down the formula in E5:G5 to wherever you need. However, I only recommend using this once only as the formulae will be slow to update over large ranges. Also if your headings are out of sync then VBA is the way forward

Add common prefix to all cells in Excel

I have a column with some text in each cell.
I want to add some text, for example "X", at the start of all cells. For example:
A B
----- >>>> ----
1 X1
2 X2
3 X3
What is the easiest way to do this?
Type this in cell B1, and copy down...
="X"&A1
This would also work:
=CONCATENATE("X",A1)
And here's one of many ways to do this in VBA (Disclaimer: I don't code in VBA very often!):
Sub AddX()
Dim i As Long
With ActiveSheet
For i = 1 To .Range("A65536").End(xlUp).Row Step 1
.Cells(i, 2).Value = "X" & Trim(Str(.Cells(i, 1).Value))
Next i
End With
End Sub
Select the cell you want to be like this,
Go To Cell Properties (or CTRL 1)
under Number tab
in custom
enter
"X"#
Select the cell you want to be like this, go to cell properties (or CTRL 1) under Number tab in custom enter "X"#
Put a space between " and # if needed
Select the cell you want,
Go To Format Cells (or CTRL+1),
Select the "custom" Tab, enter your required format like : "X"#
use a space if needed.
for example, I needed to insert the word "Hours" beside my numbers and used this format : # "hours"
Enter the function of = CONCATENATE("X",A1) in one cell other than A say D
Click the Cell D1, and drag the fill handle across the range that you want to fill.All the cells should have been added the specific prefix text.
You can see the changes made to the repective cells.
Option 1:
select the cell(s), under formatting/number/custom formatting, type in
"BOB" General
now you have a prefix "BOB" next to numbers, dates, booleans, but not next to TEXTs
Option2:
As before, but use the following format
_ "BOB" #_
now you have a prefix BOB, this works even if the cell contained text
Cheers, Sudhi
Michael.. if its just for formatting then you can format the cell to append any value.
Just right click and select Format Cell on the context menu, select custom and then specify type as you wish... for above example it would be X0. Here 'X' is the prefix and 0 is the numeric after.
Hope this helps..
Cheers...
Go to Format Cells - Custom. Type the required format into the list first. To prefix "0" before the text characters in an Excel column, use the Format 0####. Remember, use the character "#" equal to the maximum number of digits in a cell of that column. For e.g., if there are 4 cells in a column with the entries - 123, 333, 5665, 7 - use the formula 0####. Reason - A single # refers to reference of just one digit.
Another way to do this:
Put your prefix in one column say column A in excel
Put the values to which you want to add prefix in another column say column B in excel
In Column C, use this formula;
"C1=A1&B1"
Copy all the values in column C and paste it again in the same selection but as values only.
Type a value in one cell (EX:B4 CELL). For temporary use this formula in other cell (once done delete it). =CONCAT(XY,B4) . click and drag till the value you need. Copy the whole column and right click paste only values (second option).
I tried and it's working as expected.

Resources