Three variables (columns) to be combined in one variable (column) - database

demo data
Either in Excel or in Statistical Package for the Social Science:
To combine the three columns into one and to be able then to calculate the statistics of the column. Mean, Median, Mode frequencies and all these.

I too have no idea why you want what it appears you do but assuming your values are numeric to two decimal places then with Excel I suggest in D1 and copied down to suit:
=TEXT(100*A1;"000")&TEXT(100*B1;"000")&TEXT(100*C1;"000")
this results in text strings. Should you want numeric output for further processing then a double unary can be applied:
=--(TEXT(100*A1;"000")&TEXT(100*B1;"000")&TEXT(100*C1;"000"))
In the latter case Excel will automatically strip any leading zeros. In the former case (should a number less than 1 be a possibility) the TEXT function preserves leading zeros.
Multiplication by 100 is to scale up the numbers to remove the decimal separators.
If the numbers are text then they may be concatenated and the commas removed with SUBSTITUTE:
=SUBSTITUTE(A1&B1&C1;",";"")
The above results in text strings which again may be converted with the double unary operator.

Related

Matlab: non-integers or numbers below 1 as indices; numbers as field names

Matlab has limitations in terms of how things can be numbered/indexed:
Arrays and cell arrays require indices that are natural
numbers (with exceptions that are discouraged and not more general).
Field names of structure arrays can only be strings that start with a letter and are followed by letters/digits/underscores.
However, it might be common/appropriate/intuitive to number certain things using zero or negative numbers or non-integer numbers.
For example, storing more and more so-called spherical harmonics requires increasingly negative "indices".
Scaling and shifting those "indices" such that they are natural numbers, i.e. valid (cell-)array indices, has disadvantages (smaller negative indices or finer non-integer indices might appear later, requiring a recomputation of the scale or shift parameters and adjustment of the entire data structure; understanding the resulting data structure requires knowing the scale and shift parameters and requires "mental math" while looking at the data).
Is there a way without these disadvantages?
Numbers can be turned into valid field names for structure arrays for example using this function:
% Field names of Matlab structures:
% - can't start with a digit, so we prepend 'number_',
% - can't contain '-', so we replace it by 'minus',
% - can't contain '+', so we replace it by 'plus' (for numbers such as -1e+20),
% - can't contain '.', so we replace it by 'point'.
% For example, the number -0.5 turns into the string 'number_minus0point5'.
num2fieldname = #(x)(['number_' replace(replace(replace(num2str(x),'-','minus'),'.','point'),'+','plus')]);
For example, num2fieldname(-1.5e+20) yields 'number_minus1point5eplus20'.
To use them as field names, here for example using the "index" (2,-1):
mystructure.(num2fieldname(2)).(num2fieldname(-1)) = myobject
It won't work if rounding settings for num2str change.
In recent versions of MATLAB, the table data type allows arbitrary text as variable names.
containers.Map might achieve what you want. Apparently it can store any objects as values. That seems to be undocumented.

Data Type for multiple decimal points in SQL Server

I have a value that would be similar to this 0000006860.18.03 when formatting the table for sql server would I use decimal or numeric? If so could someone point me to an example. The format would always be 10 numbers, a decimal point, 2 numbers, a decimal point and 2 numbers
If you have leading zeros and/or multiple separators, you need to store that as CHAR(16). If each of the "numbers" between the separators have distinct meanings, then you have three columns, not one.
I believe that the best option is to include them between brackets as a nvarchar.
Can't be numeric when you have zeros as a start. They will automatically be deleted.
Each time you can easily convert it with try_convert
select TRY_CONVERT(int,'555')

Google Sheets Regexreplace - remove numbers, double quotes, "X" and "x" from strings

I have a listing of products that include sizes, in a variety of formats.
I need to separate them into 2 columns, 1 with the sizes, the other with the names.
So, for example, "12"x10" Large Widget" becomes [12" x 10"] [Large Widget].
I'm trying to use REGEXREPLACE to remove the numbers, but can't seem to find a combined syntax that will handle "any number, double quotes, the letter X lowercase and capital" in a single expression.
And then I'd need to do the reverse, in other words, extract JUST the numbers and double quotes and X/x, for the other column.
Can't just use SPLIT or RIGHT/LEFT, because the position of the intended split will differ from line to line. Can't "Split Text To Columns", because there are occasional double quotes in the item names too.
So I'm thinking, Step 1: filter out just the numbers and double quotes, Step 2: filter out just the names.
In other words:
Input: [14" x 17" Large Widget]
Output (2 columns): [14" x 17"] [Large Widget]
Input: [7"x2" Small Gadget]
Output (2 columns): [7"x2"] [Small Gadget]
I understand how REGEXREPLACE works, just need help with the syntax.
Thanks in advance!
try:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(A1:A, "(.+"") (.+)")))

Google Sheets ArrayFormula Solution for Multiplying 2 Columns, One of Which Is a Column of Lists of Numbers

I have 2 columns of inputs (A and B) and 1 column of output (C) with the number of rows unknown at design time. Each row’s inputs and outputs are independent; row 1 cannot affect row 2.
Column A consists of 2 possible types: a positive integer or a list of positive integers delimited by semicolons (“;”).
Column B consists of only a positive integer.
Column C is the total of column A multiplied by column B.
This is the basic formula I have devised for column C: =IF(NOT(ISBLANK($A2)),IF(ISNUMBER($B2),$A2*$B2,$B2*SUM(SPLIT($A2,"; ")))),""). And it works by filling the formula downwards, but the SUM being there makes it incompatible with ARRAYFORMULA. For robustness (because I cannot count on the users to autofill the cells themselves nor to avoid wreaking havoc on the formulae I’ve carefully laid down), I would like an ARRAYFORMULA-based solution which I can tuck inside of one protected cell in column C.
The current result using the non-ARRAYFORMULA solution:
The first 4 rows are just simple multiplication, which ARRAYFORMULA has no trouble doing. The last filled row represents (15+20+25)*1=60 which I could not do as an ARRAYFORMULA.
I have found one similar question which—unfortunately—does not apply to my case because the final solution does not use ARRAYFORMULA: sum comma delimited string of integers
try:
=ARRAYFORMULA(IF((A2:A<>"")*(ISNUMBER(B2:B)),
MMULT(IFERROR(SPLIT(A2:A, ";")*1, 0),
ROW(INDIRECT("A1:A"&COLUMNS(IFERROR(SPLIT(A2:A, ";")*1, 0))))^0)*B2:B, ))

SSRS 2005 Number formatting int and double within one field

I am using SSRS 2005. The issue is I would like to place, in numbers so if number is 23455 it should be displayed as 23,455 I know how to do this I have two data types in this field int and double. What I did to accommodate it is changed the numbers to strings but if I extract them to Excel they show green triangle.
To eliminate green triangle in Excel I used CDEC() function which converts the string to number by doing this I loose , in the numbers.
I was wondering if it is even possible to place a comma within the field which has two different datatypes i.e. double and int.
Strings are not your friends! Don't convert numbers to strings.
You should set the format of your cells (textboxes or placeholders) to include the comma. Right click on a text box or placeholder to get the properties dialog. Use the Number pane to format. (You can set this exact same setting in the properties pane as well.
Using these will let the number stay a number in the cell, and will export the formatting to Excel without the conversion to a string.

Resources