Please what is the formula to limit the number input in excel sheet.
e.g my cell A1 suppose to have the highest value of 10, to avoid putting more than 10 in that cell.
You can use the "options from list" which will only allow the values from the list to be set as value of the cell or you can put "if" function to accept or reject the input values or you can use "drop down" to do the same
Related
Problem
I'm using Microsoft Excel for data collection.
I have an excel sheet with two columns.
Column A - List
The first column is a list I created with Data Validation.
The choices are:
Cell left Blank
Numbers
Text
Column B - Conditional validated input
A column that takes user's input if not blank.
Question
I would like to prompt the user to input only if he selected option 1 or option 2.
If no choice is select, i.e. a blank cell, then there wouldn't be an input.
If option 1 is selected:
The corresponding cell in column B would accept only a 3-digit number data type.
If option 2 is selected:
The corresponding cell in column B would accept only a 10-digit text data type.
I would like the check would be based on list number, i.e. if number is 1 or if number is 2, etc.
I have a set of 10 options, so multiple conditions.
I'm using Microsoft Excel 365
Attempt
I have tried using the below formula but I'm not sure how to allow numbers or text of specific length as an input in the corresponding cell.
=IF(LEFT($A$2,1)=1,<allow numbers in B2>)
Since your 'options' all seem to start with an integer, you could use a lengthy SWITCH() function for each integer case.
For the two you mentioned ('1-Numbers' and '2-Text'), the function could look like this:
=IFERROR(
SWITCH(
VALUE(LEFT($A2,1)),
1,AND(ISNUMBER($B2),LEN($B2)=3),
2,LEN($B2)=10
),TRUE
)
What this function does is, it checks the first character in A2 through VALUE(LEFT($A2,1)), then, if it is a '1', the value in B2 has to be a number and of exactly 3 characters (AND(ISNUMBER($B2),LEN($B2)=3)), if it is a '2', the value in B2 has to have exactly 10 characters of any type (LEN($B2)=10). You can simply add more cases and corresponding limitations to that and paste the formula in a custom data validation:
The IFERROR() statement leading the function means that if the 'option' selected does not have a specified case in the data validation, any input is allowed.
I'm trying to create a new rule in my Excel sheet where if a cell is equal to 0, then the cell is filled with a specefic color.
When I apply this rule, all the empty cells take on that color as well as the cells with the value 0.
I've been looking for an option in Excel to tell it that null cells != the value 0 but I can't find anything (I know that by default 0 = null).
My rule is "if cell value is" + "equal to" + "=0"
Thanks for helping me :)
Quick edit:
Here's a screenshot of the tool I'm using to create the rule :
Create rule with type 'Use a formula to determine which cells to format', add formula
=(A1=0)*(A1<>"")
(replace A1 with first cell's address of Applies to range), select desired range into Applies to field.
You would need to determine the formatting by a formula (the last item in the dialog of which you posted a picture) and then use this formula (or its French equivalent).
=AND(VALUE(A1)=0,ISBLANK(A1)=FALSE)
You colud first transform all your empty cells in empty string and then apply the format colour if it is equal to zero.
You can transform the empty cells with this formula:
=IF(A1="","",A1)
I am using the formula:
=(Cost!C8)
to get values from another sheet using named ranges. I want this to only show a value if there is a value in the corresponding cell of the other sheet, however, this formula returns a value of 0 even if the cell on the other sheet is empty. How can I make it so that the formula returns nothing (is blank) when the cell it refers to is empty?
Invoice
There are a number of ways to prevent zero's from showing when you refer to a blank cell.
The easiest if probably an IF statement. If your formula is:
=(Cost!C8)
...use:
=IF(Cost!C8="","",Cost!C8)
Similarly you could show a default value, or a label like <No Data> with a variation:
=IF(Cost!C8="","<No Data>",Cost!C8)
Note that Cost!C8 is not a Named Range; it's a cell reference, referring to another worksheet.
More Information:
Office Support : Create conditional formulas
TechRepublic : Three ways to hide zero values in an Excel sheet
Use,
=Cost!C8&""
'alternate for Qty
=TEXT(Cost!C8, "[<>0]0;;;")
'alternate for currency
=TEXT(Cost!C8, "[<>0]$ 0.00;;;")
'alternate for text items
=TEXT(Cost!C8, ";;;#")
Granted, this actually converts your true numbers to text-that-looks-like-a-number and that is generally a practice to be avoided but they will be converted back to true numbers through any maths operation like addition or multiplication.
A blank cell is considered numeric by nature. This can be tested with =ISNUMBER(<blank_cell>). The closest thing to a blank number is zero so you are returning those as the value of the blank cells you are linking to.
Use ISBLANK with IF
=IF(ISBLANK(Cost!C8),"",Cost!C8)
If you just want it to not be visible, you might consider using conditional formatting to make the text color white when the cell is equal to 0. This way the actual value remains 0 so it won't break downstream formulas.
A nice, slightly simpler, alternative is to concatenate the named range with an empty string.
=MyRange --> 0
=""&MyRange --> ""
This is equivalent to TEXT(MyRange) more concise than IF(ISBLANK(MyRange), "", MyRange)
I want to create a switch for one of my criteria in a countifs-formula, using a dropdown list. For example:
I want to count all the companies that match criterion 1 (area), and then have a second criterion, size, whose value I can change using a dropdown list, and which can be set to "small", "big" or "both". The "both" part is where I can't figure out what to do.
With "limit values" on a cell (D1) that only allows 1 ("small") and 2 ("big"), and a reference to that cell, the first part is easy:
=countifs(A1:A10,"Munich",B1:B10,"="&D1)
What I'm wondering is what I would have to put into D1 that tells the function to count "all". Normally, you would simply use "<>" instead of "="&"..." to count all the non empty cells, but that's not an an option here. I tried putting * in D1 as well as ="*", but he won't recognize that (I gues due to the values being numbers and not text). I'm stuck.
Thanks for your help.
Edit:
For completenes' sake: I just tried to use the formula on a criterion where the data is text, not numbers, and in this case using an asterisk * works just fine. So if the column has "big" and "small" instead of "1" and "2" for values, and you put * into D1, it counts all non empty cells. Hooray :)
Use an IF on the outside that checks for the word "All":
=IF(D1="All",COUNTIF(A:A,"Munich"),COUNTIFS(A:A,"Munich",B:B,D1))
This array formula will do it also:
=SUM(COUNTIFS(A:A,"Munich",B:B,IF(D1="all",{1,2},D1)))
The formula needs to be entered with Ctrl-Shift-enter instead of Enter when exiting edit mode.
I have a range in excel with dates and values
http://lh4.ggpht.com/_i-hI_3gfy08/SoSIopeZUZI/AAAAAAAABEk/KjFnq57VTUc/table.png
EDIT:image added
I want to select the MAX value from the HIGH column for each YEAR (2009 would return 404, 2008 would return 390)
I've done something similar but it's using SUMIF, not MAX.
Any excel people in here that can help me out?
The equivalent of SUMIF in Excel is something like this:
{=MAX(IF(CategoryColumn="High",ValueColumn,"")}
Where
CategoryColumn is the column containing your categories (e.g., "Low", "Med", "High")
ValueColumn is the column containing the data you want to get the max of
NOTE: This is an array formula so you must press Ctrl-Shift-Enter when entering this formula instead of just Enter. Also, don't actually type in the braces {}. The braces show up automatically to indicate that you've entered an array formula.
NOTE 2: You can actually name a range of data. For example, select the range A1:A20. Right-Click and select "Name a Range..." So, for this example, you can select your category column and name it CategoryColumn. Same with ValueColumn.
Array formulas allow you to do IF statements and other functions on a whole range of data instead of just a single value.
This example checks if the value in the "category column" is "High". If it is, it puts the neighboring "value" into the MAX function, otherwise it puts a blank. This gives you the maximum of all the "High" values.
P.S. I don't think the img tag works on this site...can't see your image.
There are three options available.
My preferred option is to create a pivot table without a helper column.
Option 1: Use a pivot table
Create a pivot table of your data.
Set the row to the date field and group it by year.
Alternately a 'Year' helper column could be used by adding a column with this formula.
=YEAR(A2)
Set the data items value portion of the pivot table to be the MAX of your 'High' field
Option 2: Use the DMAX function
Add a helper column titled year with the formula
=YEAR(A2)
Then add a formula for each year
=DMAX(A1:C21,"High",F13:F14)
Option 3: Use an array formula
Enter an array formula for each year using the Ctrl-Shift-Enter keys.
{=MAX(IF(YEAR(A2:A21)=2008,B2:B21))}