How to set a 0 default value within a range of cells? - excel

I am using a range of cells (columns F-G-H) for estimation purposes, and having an estimate of 0 hours is acceptable, however blank/empty is not. Seeing as users can add rows as they see fit I want to ensure that all cells in columns (F-G-H) except for the header (row1) default to 0 (and the user can change / overwrite it) if needed.
Is there a way I can enforce this for newly created rows for this specific range? I know I can use a formula in the existing cells but that doesn't help for rows that are user-created after the fact.
(BTW - simularily for column C I want to default the cell to "WI-" and for column D I want to default the cell to "REQ-", etc...).
Any help/hints/ideas would be much appreciated.
Thanks,

Do this.
Enter the number 1 in an unused cell
Copy that cell.
Highlight the cells in which you want blanks replaced by zeros.
Choose Edit > Paste Special from the menu.
In the Operation section of the dialog box select Multiply and click on OK.
Numeric cells won't change and Cells containing any text data will be ignored.
All blank cells will now contain a zero.
For this to apply to newly added rows, use the Worksheet_Change event in which you will predefine your range where this will be applicable. Simply record a macro for the above steps and use that code in the Worksheet_Change event.
Also remember to use proper error handling and set Application.EnableEvents = False and reset it again in the error handler.
(BTW - simularily for column C I want to default the cell to "WI-" and for column D I want to default the cell to "REQ-", etc...).
For this the above method will not work. You will have to handle that in VBA

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 formula help needed highligh based on data validation list in cell

I have many columns with different Data Validation lists so clients can select the correct options.
Each is column specific and doesn't link to another column or cell.
These lists are typed into the Data Validation list option, and they do not exist on the spreadsheet themselves to be selected as a range in the Data Validation list option.
Example: (this is simplified, I have about 40 country codes in this list)
Column A header in Row 1 is Country Code.
Rows 2-10 have a list of: USA,AUS,CAN,GBR,PRI .... etc.
What I need to do when any of the below applies:
If any option from the list is not selected the cell turns red.
Case sensitive. Must be all caps, so if they paste "usa", instead of "USA" the cell becomes red so they know what they did is invalid.
Ensure that if no data is in column B in the same row, that column A can be blank (for this I generally use =A2="" highlight the needed range, and format no fill no boarder etc. If that needs to changed based on any possible formulas for the other requirements, please let me know.)
I have figured out the formula for these requirements if I use a list range of the data on another tab. =MATCH(TRUE,EXACT(A2,Sheet1!$A$2:$A$10),1)
But, are there formulas that I can use to do this with the existing Data Validation lists without having to re-create the lists on another tab of the spreadsheet?
Or, is creating the lists on another tab the only way to accomplish this?
Issue 1 can be solved with Conditional Formatting. New rule, format only cells that contain, Format only cells with: Blanks, set format fill to red.
OR
Issue 1 and 2 can be solved with Data validation, Allow: List, Source = $A$2:$A$41 (or the correct location if you move the selections to a new tab). This way their only option is to select valid choices.
I'm not sure what you are asking for with issue 3

Structured references vs explicit cell references

I'm using Index-Match to match Full Names with head count in that party.
I have it working but it uses both the structured and explicit cell reference.
I can't figure out why when I add a new row in my table, the column with the index-match formula wont populate the last row.
This is the formula used:
=IFNA(INDEX(AA:AA,MATCH([#[Preferred Seating 1st Choice]],D:D,0)),"")
Column AA has the head count number and column D has the list of full names.
Preferred Seating is the column used to reference the search.
I looked around and can't seem to find why it wont fill in the last row after that rown info is entered.
I can only assume it has something to do with the mixed Explicit-structured cell/column references. Any help please.
Yes Excel may not automatically assume a formula needs to be automatically filled in an entire table column if it contains unusual references. Unless you have data outside the table, you should just refer to the columns in the table:
=IFNA(INDEX([Column AA Name],MATCH([#[Preferred Seating 1st Choice]],[Column D Name],0)),"")
These can be easily entered when editing the formula by selecting all cells in the source columns excluding the heading. The formula will always use the entire
source columns and the formula should automatically fill its own entire column.
You can also control whether a column automatically has its formula updated through a hidden property. The ability to change the behavior of the column only appears through the front end when you're making changes to the column.
After entering a formula in a column, Excel will either automatically fill the entire column and give you the option to turn off the automatic fill, or Excel will not automatically fill the entire column and give you the option to turn it on.
After entering a formula that isn't being filled, this icon will appear:
Click it and then select to Overwrite all cells in this column with this formula
Deleting a formula from one cell in a column that is being automatically filled will turn off the automatic fill. Double clicking a cell with a formula and pressing enter will give you the option to turn it on again.

Highlighting cells in a column based on other cells dates in the same row

I have a spreadsheet that is used to track the last date a set of logs was downloaded.
We need to take logs at around the 7 day mark if possible (not critical)..
We have approximately 170 assets that we do this to.
The way the spreadsheet is set up the new date is added to an ever expanding list (rather than just overwriting) i have used conditional formatting to show that a date is less than 7 days old but that cell can be 20 columns accross and is still hard to cross reference to the asset number. I want to highlight column A if any other cell in the same row is highlighted (unless you have a less clunky way of doing it, having the date highlighted really is unimportant it is simply as far as i can get on my own.
I even tried doing a sort by cell colour but that seems to require that i pick one coulmn only.
Thanks for your help.
Conditional formatting will do this for you. I used this example:Column A has dates, Columns B and C have miscellaneous gibberish. (click the link to view the image)
Select the entire range of cells you want to follow these rules (possibly just "select all" to be sure you are getting future additions as well, then choose Conditional Formatting from the ribbon.
Conditional Formatting > Use a formula to determine...
Then enter the following code. =TODAY()-$A2<7 Update $A2 with whatever cell contains your first date value, and be sure to put a $ in front of its column reference so that the formula references only your date column and doesn't wander.Code: =TODAY()-$A2<7
Click the "Format" button to set whatever format you like (I chose yellow fill).

Highlight Cells Returning True For Countifs

I have a sheet with 10k+ rows that I get every day. I have about 50 formulae that I run against this sheet to count certain occurrences, and example of this is
=COUNTIFS(B:B,"*.jpg")
But as well as returning the totals I want the sheet to highlight every row that has been counted.
I thought I could maybe to that with conditional formatting but I cannot get it to work.
Thanks for any advice.
I have attached a snap shot of an example sheet where the rows are colour banded using conditional formatting.
The rule I used to validate if formatting applies has to equate to TRUE. I test my rule off to the side in cell E1 in this case. I can also copy it across to make sure I have the $ in the right spot. When its doing what I want and evaluating to TRUE or FALSE in the right spots, I edit the cell and copy the formula. I then highlight the range I want to apply it to, in this case A1 to B7 (though technically we can adjust later), and I make sure that A1 is the active cell in the selection. Then I go to the Home Ribbon and select conditional formatting and get the pop up window below:
You can select all the formatting options for when things are true by left clicking the "Format..." button.
As per Tim's s comment, select the last one from the rule type list "Use a formula...". in the blank bar below paste your rule that will equate to TRUE or FALSE. so in our case the rule I used was:
=ISNUMBER(SEARCH($C$1,$A1))
Basically I am doing a non case sensitive search in cell A for the criteria in C. IF cell A1 has it, it will return a number. ISNUMBER will check that its a number and return TRUE. If it could not find C1 in cell A1 then it would return an error and ISNUMBER would come out false.
Finally we can see where the rule will apply. So if you have 10K rows, it may be easier to simply type in the number of the last row here instead of selecting it manually, though that would still work.
I created 1 colouring rule for each file type I was searching for.
UPDATE
I am not familiar with how your internal array of {"File","VALID"} works, but I am going to assume that you want to count them if column D is equal to one OR the other AND column F is equal to "G_NOT". In this case since those are the only words in the appropriate cell I will not use the search method and instead just use the following as your formula rule for conditional formatting:
=AND($F1="G_NOT",OR($D1="FILE",$D1="VALID"))
This assumes there is no header row and your data starts in row 1. If you have a header row change change those 1 to 2. Have your left most Cell to your right most cell selected with the left most cell being the active cell. Then go into your conditional formatting. When you are done you can manage your rules, and adjust your range to go to the last row.

Resources