IF(isnumber(search( formula using named/cell ranges? GOOGLE SHEETS
First things first, simplify the formula.
Original
=IF(ISNUMBER(SEARCH("Legs",$E$19)),
$D$7,
IF(ISNUMBER(SEARCH("Chest",$E$19)),
$D$8,
IF(ISNUMBER(SEARCH("Back",$E$19)),
$D$9,
IF(ISNUMBER(SEARCH("Shoulders/Traps",$E$19)),
$D$10,
IF(ISNUMBER(SEARCH("Biceps",$E$19)),
$D$11,
IF(ISNUMBER(SEARCH("Triceps",$E$19)),
$D$12
)
)
)
)
)
)Simplified and Excel-compatible
=iferror(index($D$7:$D$12,
match(1,index(countif($E$19,
"*"&{"Legs";"Chest";"Back";"Shoulders/Traps";"Biceps";"Triceps"}&"*"
),0),0)),FALSE)If the various muscle groups were in a 6 row by 1 column range named MGs and D7:D12 were named Vals, you could use
=iferror(index(Vals,match(1,index(countif($E$19,"*"&MGs&"*"),0),0)),FALSE)
The FALSE terms reproduce your original formula's results when E19 doesn't contain any text which matches a value in MGs. Sheets allows for a more elegant way to handle this case.
=vlookup(1,{{index(countif($E$19,"*"&MGs&"*"),0);1},{Vals;"no matches"}},2,0) More on reddit.com Check entered numbers using ISNUMBER with conditions - Google Docs Editors Community
google sheets - Check if number in range - Stack Overflow
Checking if a value is within one of many ranges
How to use ISNUMBER Google Sheets formula?
What does the ISNUMBER Google Sheets formula do?
ISNUMBER formula is used to check if a given value is a number. It returns TRUE if the value is a number and FALSE if it is not. This formula is commonly used in data cleaning and validation to identify and remove non-numeric values or to ensure that a cell only contains a number.Why is ISNUMBER Google Sheets formula not working?
Hello,
I am trying to make an if statement using cell ranges. Instead of manually entering in each single statement, say for example, legs, arms, back, this would take hours.
I would like to figure out how to make a search that uses cell ranges/named ranges.
=IF(ISNUMBER(SEARCH("Legs",$E$19)),$D$7,IF(ISNUMBER(SEARCH("Chest",$E$19)),$D$8,IF(ISNUMBER(SEARCH("Back",$E$19)),$D$9,IF(ISNUMBER(SEARCH("Shoulders/Traps",$E$19)),$D$10,IF(ISNUMBER(SEARCH("Biceps",$E$19)),$D$11,IF(ISNUMBER(SEARCH("Triceps",$E$19)),$D$12))))))
For example, this is what one of my formulas looks like. Instead of having to list out each one, I would like to make a named range and combine them into 1 formula. Thanks
Anyone that can help out?
I am using Google Sheets
IF(AND(logical_expression1, logical_expression2), value_if_true, value_if_false)
EDIT: IF(AND(a1 >=1, a1 <= 7),value_if_true, value_if_false)
https://support.google.com/docs/table/25273?hl=en
Use ISBETWEEN() function:
ISBETWEEN function checks whether a provided number is between two other numbers either inclusively or exclusively.
Usage in your case (a === A1 cell):
=ISBETWEEN(A1; 1; 7)
If a is in the range 1 - 7 it returns TRUE.
You can also set optional settings for inclusive/exclusive lower/upper value - by default is set to inclusive for both.
Parts of a ISBETWEEN function:
ISBETWEEN(value_to_compare, lower_value, upper_value, lower_value_is_inclusive, upper_value_is_inclusive)
| Part | Description |
|---|---|
| value_to_compare | The value to test as being between lower_value and upper_value. |
| lower_value | The lower boundary of the range of values that value_to_compare can fall within. |
| upper_value | The upper boundary of the range of values that value_to_compare can fall within. |
| lower_value_is_inclusive [optional] | Whether the range of values includes the lower_value. By default this is TRUE |
| upper_value_is_inclusive [optional] | Whether the range of values includes the upper_value. By default this is TRUE |
For more information see: https://support.google.com/docs/answer/10538337?hl=en