I am trying to concatenate 3 columns of data where 1 of the columns may contain no value. They are all number strings, and I want to concatenate each string with a dot in between. However, if the third column is blank, I don't want the extra dot to show. I have tried doing a 2 step process where I concatenate columns 1 & 2 with a dot separator (because there is always data in columns 1 & 2). Then in a separate column I tried using an if statement to indicate that if the third column is blank, give me the results from the concatenated column I created, otherwise, give me the concatenated column + "." + third column.
Sample of data:
Column 1 Column 2 Column 3 Concat 1+"."+2 What I want
1 1310 1 1.1310 1.1310.1
19250 8550 19250.8550 19250.8550
77171 5199 LAB 77171.5199 77171.5199.LAB
In the first and third examples, I get what I want. But in the second example I end up with 19250.8550. - I don't want that extra dot at the end of the string.
Any thoughts?
Thanks
how about this
=A2&"."&B2&IF(C2&""="", "", ".")&C2
Related
I have the following data in my excel.
A
Text 1
Text 2
Text 3
Text 4
Text 5
Text 6
I want to fill column B with random joined data from column A. It should respect the criteria 1> B > 6. i.e. Column B should have a min 1 value from column A or can have a max of up to 6 unique values joined by ,. I can have column B dragged up to 100 rows. But still, they should respect the criteria.
I'm able to get a random value from column A using the formula INDEX($A$1:$A$6, RANDBETWEEN(1, ROWS($A$1:$A$6)), 1), and to join 2 random texts I'm using the formula
=TEXTJOIN(",",true, INDEX($A$1:$A$6, RANDBETWEEN(1, ROWS($A$1:$A$6)), 1), INDEX($A$1:$A$6, RANDBETWEEN(1, ROWS($A$1:$A$6)), 1))
Currently, I'm able to get 2 fixed strings using this formula. Instead of doing the above 6 times, I want to know If there is a way to get this joined string with a random number of unique strings(of the max size of column A length concatenated with a ,).
I'm able to get only 1 value using the random function. Please let me know how can I do this.
You could try:
Formula in B1:
=TEXTJOIN(",",,TAKE(SORTBY(A1:A6,RANDARRAY(COUNTA(A1:A6))),RANDBETWEEN(1,6)))
Note that TAKE() is a new function which is still in BETA. If you don't have access just yet, then try:
=TEXTJOIN(",",,INDEX(SORTBY(A1:A6,RANDARRAY(COUNTA(A1:A6))),SEQUENCE(RANDBETWEEN(1,6))))
In each option:
SORTBY(A1:A6,RANDARRAY(COUNTA(A1:A6))) - Will create a randomized array of the values in column A;
RANDBETWEEN(1,6) - The part which defines the lower- & upper-limit of strings to concatenate;
TAKE/INDEX - A way to retrieve an X amount of rows from the above randomized array. In your case X itself is randomized (see 2nd bullit);
TEXTJOIN() - Concatenate all selected values into a single string.
This formula exploits the functions RANDARRAY and RANDBETWEEN to get a random number of text items to join.
First, I created a dynamic named range called AllTextItems. This automatically expands to capture any number of rows in your dataset:
Then, use the formula:
=TEXTJOIN(",",TRUE,INDEX(AllTextItems,RANDARRAY(RANDBETWEEN(1,ROWS(AllTextItems)),1,1,ROWS(AllTextItems),TRUE)))
in the cells you'd like your joined list.
=TEXTJOIN(",", TRUE, INDEX(A:A, RANDARRAY(1, RANDBETWEEN(1, COUNTA(A:A)), 1, COUNTA(A:A), TRUE)))
EDIT didn't quite beat JvdV to it, but basically a similar basis to his but not using TAKE and not sorting the output
I have a spreadsheet (Gantt chart) with dates in a column. Refer to the table below. The "Row" column is the row number in Excel, not a real column.
Row
Depends on Row(s) (Col F)
Start (Col G)
End (Col H)
Notes
9
7/24/21
7/26/21
10
9
7/27/21
7/30/21
Starts 1 day after row 9 ends.
11
7/25/21
7/27/21
12
9,11
7/28/21
7/29/21
Starts 1 day after MAX(row 9 end, row 11 end).
How do I automatically set cells "Start10" and "Start12" to read from cell "DependsOnRows" in their row to get the max of any numbers in the "DependsOnRows" column using a formula or other method?
Currently, I'm using this formula in cells "Start10" and "Start12", which includes a manually typed "max" function:
Start10:
=WORKDAY(MAX(H9), 1, Holidays!A$2:A$99)
Start12:
=WORKDAY(MAX(H9,H11), 1, Holidays!A$2:A$99)
I want to automate the reading of the row numbers inside the max function so they are read from the "DependsOnRows" column.
I can use any format in the "DependsOnRows" column. I can use braces, brackets, commas, spaces, whatever. The list just ideally needs to be in 1 cell, not multiple.
You can use the FILTERXML function to change the string of row numbers into a dynamic array. From there, you can INDEX the position of each row along with a fixed column number (in this case 8, or column H) to get test values for the MAX function.
Something like the below works for me:
=WORKDAY(MAX(
INDEX($A$1:$I$13,
FILTERXML("<t><s>" &SUBSTITUTE($F13, ",", "</s><s>")&"</s></t>", "//s"),8)),
1, Holidays!A$2:A$99)
I have a situation where I would like to merge two columns in to one.
Example : column 2 and 3 data should get merged in column 1 (column 1 is empty). column 2 is string while column 3 has date.
I can use concatenate function. However, I would like to use array in order to boost the speed.
Try:(adjust to your range(s)
[A1:A5] = [B1:B5&" "&TEXT(C1:C5,"DD-MM-YYYY")]
I want to merge two cells in excel that have a value like this:
'a b c
1 1 11
1 2 12
1
2
1
2 2 22
'
I don't want to merge the number with a blank...
any help for that? I used concatenate function but it cannot help me ...
You can produce column C using an if statement and the "&" operator.
=IF(LEN(B2)<1,"",A2&B2)
If you want C to be blank in the case where A is blank, then you'll need an or statement also.
Assuming the data are orientated in columns A and B starting at row 1, =IF(OR(ISBLANK(A1), ISBLANK(B1)),"",CONCATENATE(A1,B1)) is one way. Copy this downwards.
The returned value is a string type. A blank string is inserted into rows where either a or b are not given.
=IF(VALUE(A1)=VALUE(B1),CONCATENATE(A1,B1),"")
OR
=IF(A1=B1,CONCATENATE(A1,B1),"")
I have this text in an Excel cell in column A: 2 / 12 and want to make this subtraction in another cell in column B: =12-2.
For example, values in column A are:
2 /12
3 / 10
0 / l8
0 / 0
and I want to do this subtraction in column B:
= 12-2
= 10-3
= 18-0
= 0-0
I want to appear only the results ex. 10, 7, 18, 0
How can I do this for multiple cells?
Please try:
=RIGHT(A1,FIND("/",A1))-LEFT(A1,2)
copied down to suit.
Excel has built in Text to columns feature that would probably be useful in this case.
Under data
click Text to columns
selected Delimited
Click Next
Under Delimiters in "Other" enter "/" (without parenthesis) click finish.
That should give you 2 separate columns with your values you should then be able to easily subtract them in an adjacent cell.
This is a little weird for an excel file. I am going to make an assumption that your data in column A is formatted as "Text" because otherwise it would be calculating the value. I also assumed that there is a space between the numbers and the /. So with those assumptions in mind you could have this function in column B to get your result.
This example is for Row 1 of course but you simply copy down for the other rows accordingly
=(RIGHT(A1,LEN(A1)-FIND("/",A1)))-(LEFT(A1,FIND("/",A1)-1))