- 2 of 6 -
TEXT MANIPULATION
The MID function returns a substring from the
input text and has the following syntax:
MID(Text, StartIndex, Length). This function
could be used to return the node number from a
{Submodel.NodeNumber} syntax. However,
often the starting location of the substring to be
returned is not known explicitly. For this, the
FIND and LEN functions are used. FIND returns
the location in the string where a particular
search string is found and has the following
syntax: FIND(FindText, WithinText, StartIndex).
A StartIndex of 1 indicates to begin searching
from the beginning of the text. The LEN function
simply returns the length of the argument text
and has the following syntax: LEN(Text).
Combining the LEN and FIND results allows a
user to determine the number of characters to
return from the MID function. The TEXT
function can be used to output text into the
desired format and has the syntax: TEXT(text,
format). Finally, the & character can be used to
combine substrings into a single output string.
The following examples assume that cell B3
contains the string “SPACE.1234”.
=MID(B3, 7, 4) yields 1234
=MID(B3, 1, FIND(“.”,B3,1)-1) yields SPACE
=MID(B3, FIND(“.”,B3,1)+1, LEN(B3)-FIND(“.”, B3, 1))
yields 1234
=TEXT(MID(B3, 7, 4),”0.00E+00”) yields 1.23E+03
=“SPACE“ & “.1234“ yields SPACE.1234
CONDITIONAL and BOOLEAN OPERATIONS
IF is a simple condition check, with the following
syntax: IF(LogicalTest, Value If True, Value If
False). ISERROR, ISTEXT, ISNUMBER, and
ISBLANK are all used to determine if a particular
cell or value returns an error or is text, numeric
or blank respectively.
To combine LogicalTests, values may be
ANDed, ORed, or NOTed. The syntax is as
follows: AND|OR|NOT(Condition1, Condition2,
Condition3 …) For AND, all conditions must be
TRUE for a TRUE value to be returned; for OR,
if any of the arguments are TRUE, then a TRUE
value is returned. NOT simply inverts a FALSE
to a TRUE and vice versa. Nesting these values
allows a user to create complicated conditions to
be tested including all three Boolean operations.
Assuming Cell B3 contains the string
“SPACE.12”, the following formulas would yield
the results listed.
=IF(MID(B3, 7, 2)=”12”, ”Is12”, ”IsNot12”) yields Is12
=IF(NOT(MID(B3, 1, 5)=”SPACE”)),”Not Space”, “Is
Space”) yields Is Space
=IF(OR(MID(B3, 7 ,2)=”12”, MID(B3, 1, 5)=“SPACE”),
”Is12orSpace”,”IsNot12orSpace”) yields Is12orSpace
=IF(AND(MID(B3, 7, 2)=”13”, MID(B3, 1, 5)=“SPACE”),
”IsSpace13”,”IsNotSpace13”) yields IsNotSpace13
SUMIF
The SUMIF function searches for a specified
value over a range of data and returns the sum
of all values found from either the search range
or a specified return range. The syntax is as
follows: SUMIF(SearchRange, SearchValue,
ReturnRange). If a user enters a column of data
for the SearchRange and a different column for
the ReturnRange, then any values matching the
SearchValue would return the value in the
ReturnRange at the same row/column. If no
ReturnRange is specified, then the summed
values will be taken from the SearchRange. For
unique data (i.e. thermal nodes), SUMIF will
return only one value.
A B C D
1 Submodel Node T(1) T(2)
2 SUB1 SUB1.1 25.2 26.0
3 SUB1 SUB1.2 26.7 27.0
4 SUB1 SUB1.3 31.8 31.8
5 SUB2 SUB2.1 29.6 29.7
6 SUB2 SUB2.2 50.2 52.0
Sample Data 1
=SUMIF($B$2:$B$6,”SUB1.2”,$C$2:$C$6) yields 26.7
=SUMIF($B$2:$B$6,”SUB2.2”,$D$2:$D$6) yields 52.0
=SUMIF($B$2:$B$6,”SUB3.2”,$D$2:$D$6) yields 0.0
SUMIF can also be used to find the total
heatload applied to a group of nodes.
A B C D
1 Submodel Node Q(1) Q(2)
2 SUB1 SUB1.1 2.5 2.5
3 SUB1 SUB1.2 2.5 2.5
4 SUB1 SUB1.3 3.5 3.5
5 SUB2 SUB2.1 1.71 1.75
6 SUB2 SUB2.2 1.63 1.67
Sample Data 2
=SUMIF($A$2:$A$6,”SUB1”,$C$2:$C$6) yields 8.5
=SUMIF($A$2:$A$6,”SUB2”,$D$2:$D$6) yields 3.42
=SUMIF($A$2:$A$6,”SUB3”,$D$2:$D$6) yields 0.0 (not
found)