How Can I Concatenate Many Sets of Columns Into Several New Columns? - concatenation

I have a spreadsheet. 60 rows, ~100 columns.
I wish to concatenate the data from each set of 3 columns, to produce ~30 columns of 'merged' data.
e.g. currently columns include "Fighter 1", "Fighter 2", Fighter 3", "Wizard 1", "Wizard 2", Wizard 3" etc.
i wish to put the data from each set into I column each, labelled "Fighter", "Wizard" etc. with the data from the three columns 'merged', with a delimiter (:). I need Empty Cells included.
I know I can use CONCATENATE(B2, C2, D2) to combine the data from one set of cells.
I can Drag this formula down, to fill the column.
But if I drag the Formula sidewards (to the right), it increments each value by 1, rather than the 3 that I need.
e.g. I want the columns to become (B2, C2, D2), (E2, F2, G2), (H2, I2, J2) etc, but I get (B2, C2, D2), (C2, D2, E2), (D2, E2, F2) ...

You could make use of the OFFSET function
We'll start with the premise that your data spans Column A to Column CU (1-99) and your "merged" data spans column CW to Column EC (101-133).
Starting with Cell CW2 (assuming your headers are on row 1), write this formula (I've added line breaks to make it easier to read):
=CONCATENATE(
OFFSET($A2, 0, 3 * (COLUMN() - 101)),
OFFSET($B2, 0, 3 * (COLUMN() - 101)),
OFFSET($C2, 0, 3 * (COLUMN() - 101))
)
This will concatenate together the three adjacent columns of the original dataset, and when you drag-fill the formula to each of the next 32 columns, each merged column will have been offset by exactly three cells each, lining them up to concatenate all your data.
The important parts that you might need to change in that function for your use:
$A2 It's important to start with whichever column is the start of your entire dataset, not just the columns relative to each merged set. Other than that though, if your data starts at Column C or E or Z or wherever, this will still work so long as this references that first column.
3 Is a reference to how many columns you're grouping by. If you had a series like "Fighter 1" "Fighter 2" "Fighter 3" "Fighter 4" "Wizard 1" "Wizard 2" "Wizard 3" "Wizard 4"...., then you'd use 4 instead of 3.
101 is the 1-indexed column of the start of your "Merged" data. That way, COLUMN()-101 is 0 for the first column, 1 for the second, 2 for the third, and so on. This then gets multiplied by 3 above to yield 0, 3, 6, 9, ...

Related

Google Spreadsheet MAX + Join of other cells

I have a spreadsheet like this - I can't figure out how to dynamically search for this.
I want to find the MAX Score Value + output the related name
(no worries, in another column I've got the Score calculated as clean numbers without letters).
(QUERY doesn't really work because once I change a score, it doesn't update that output)
use:
=SORTN(SORT({x2:x, y2:y}, 2, 0), 9^9, 2, 1, 1)
where:
x2:x - column with names
y2:y - column with values
2 - sort values
0 - in descending order
9^9 - return all rows
2 - 2nd mode of sortn eg. group by
1 - names column
1 - in ascending order

ISBLANK(...) = FALSE even thought the cell is blank in google sheet

Hi everyone,
I have 2 tables, 3rd column for Table 1 is Value 1 and 3rd column for Table 2 is Value 2. I combined these 2 tables by expanding both tables first so that all the columns are aligned as shown in the screenshot above (Column E to Column H).
The formula in all the yellow cells are:
Cell E4 : =QUERY(A4:C10,"Select A,B,C,' ' label ' ' 'Value 2' ")
Cell E12 : =QUERY(A12:C20,"Select A,B,' ',C label ' ' 'Value 1' ")
Cell K7 : =QUERY({E5:H10;E13:H17},"Select * where Col1 is not null",0)
Cell P7 : =ArrayFormula(IF(ISBLANK(M7:M12),100,M7:M12))
In column P, I want to return 100 as Value 1 if the cells in Column M is blank. So by right I should get 2,34,55,100,100,100 in column P but right now the formula still return 3 blank cells.
I suspect that is because the QUERY function that I used before which make the cell is not blank although it seems like still a blank cell. May I know is there any trick that I can use to find the blank cells in column M and column N (preferably don't touch the QUERY formula) since ISBLANK() is not working in this case?
Any help or advise will be greatly appreciated!
Edited
makes sense. you cant use ISBLANK because cell is not blank. remember that QUERY inserted an empty space.
try:
=ARRAYFORMULA(IF(ISBLANK(TRIM(M7:M12)), 100, M7:M12))
ISBLANK is so sensitive that it will detect even residue from TRIM
update:
=ARRAYFORMULA(IF(TRIM(M7:M12)="", 100, M7:M12))

Array formula to check for blanks

I have a google sheet with customer orders.
Column A contains the order number
The next four columns contain various data, filled at various stages of the order. (Columns B through E)
In Column F I'd like to have an array formula that checks when the orders are complete, i.e. each column in a row is filled in, for all rows that contain an order number.
Therefore, if A2:E2 are all filled with data, then in F2 it should state "Complete".
I've tried:
COUNTA
ISBLANK
AND
OR
COUNTBLANK
All formula work on a row by row basis, but not when entered in an arrayformula.
=ArrayFormula(if(and(LEN(A2:A),COUNTA($B2:E)=0)="True","Complete","There be blanks afoot")
Or
=ArrayFormula(If(LEN(A3:A),IF(COUNTBLANK($B2:$E)>0,"Blanks","No Blanks"),""))
Test sheet can be found here:
https://docs.google.com/spreadsheets/d/1mNIGRh910k_q9J2P6mzv9q-h-me3zxbCWeJ2mcaFsXQ/edit?usp=sharing
try:
={"Status"; ARRAYFORMULA(IF(A2:A<>"", IF(MMULT(
IF(B2:E<>"", 1, 0), {1;1;1;1})=4, "Complete", "Still blanks"), ))}

color first five rows of a table in SSRS

Iam developing a report where I need to provide special effects on 1st few columns. How can I color code or provide 3D effect for first five rows of a table in SSRS? Also, count of values in these columns?
For example:
My date count
A 3
B 4
C 1
D 1
E 5
F 6
G 7
Now, I should color rows start from A to E and get total count of that ( e.g. 14 in this case)
How can I I acheive this?
While Strawberryshrub's answer would probably work just fine, there's an easier way that can get you the same result. You should be able to use the SSRS function RowNumber to indicate which rows should be colored. Try the following expression in the background color property for that row.
=IIF(RowNumber(Nothing) < 6, "Green", "No Color")
Also, for the count that you need, you should be able to use a similar pattern.
=SUM(IIF(RowNumber(Nothing) < 6, Fields!count.Value, 0))
One possible option is to cathegorize your first column with an calculated field:
'Name: CustomCathegory
=IIF(Fields!MyDae.Value = "A" Or
Fields!MyDae.Value = "B" Or
Fields!MyDae.Value = "C" Or
Fields!MyDae.Value = "D" Or
Fields!MyDae.Value = "E", "Cathegory1", "CathegoryElse")
Now you can use the row coloring (font or background) and use the following expression:
=IIF(Fields!CustomCathegory = "Cathegory1", "Blue", "Black")
You can also sum by CustomCathegory (textbox outside the detail section)
=Sum(IIF(Fields!CustomCathegory = "Cathegory1", Fields!Count.Value, 0))
or group your table by CustomCathegory and add header or footer with the sum per CustomCathegory

Counting rows in a table based on multiple array criterias

I am trying to count rows in a table based on multiple criteria in different columns of that table. The criteria are not directly in the formula though; they are arrays which I would like to refer to (and not list them in the formula directly).
Range table example:
Group Status
a 1
b 4
b 6
c 4
a 6
d 5
d 4
a 2
b 2
d 3
b 2
c 1
c 2
c 1
a 4
b 3
Criteria/arrays example:
group
a
b
status
1
2
3
I am able to do this if i only have one array search through a range (1 column) in that table:
{=SUM(COUNTIFS(data[Group],group[group]))}
Returns "9" as expected (=sum of rows in the group column of the data table which match any values in group[group])
But if I add a second different range and a different array I get an incorrect result:
{=SUM(COUNTIFS(data[Group],group[group], data[Status],status[status]))}
Returns "3" but should return "5" (=sum of rows which have 1, 2 or 3 in the status column and a or b in the group column)
I searched and googled for various ideas related to using sumproduct or defining arrays within the formula instead of classifying the whole formula as an array but I was not able to get expected results via those means.
Thank you for your help.
Because your group and status criteria are a different number of values (2 values for group, but 3 values for status), I'm not sure you can do this in a single formula. Best way I know of to do this would be to use a helper column (which can be hidden if preferred).
Put this array formula in a helper column and copy down the length of your data (array formulas must be confirmed with Ctrl+Shift+Enter):
=AND(OR(data[#Group]=group[group]),OR(data[#Status]=status[status]))
And then get the count with: =COUNTIF(helpercolumn,TRUE)
You could use a slightly different approach, using Power Query / Power Pivot.
Name your tables Data, Group and Status, then create the following query, named Filtered Data:
let
tbData = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
tbGroup = Excel.CurrentWorkbook(){[Name="Group"]}[Content],
tbStatus = Excel.CurrentWorkbook(){[Name="Status"]}[Content],
#"Merged Group" = Table.NestedJoin(tbData,{"Group"},tbGroup,{"Group"},"tbGroup",JoinKind.Inner),
#"Merged Status" = Table.NestedJoin(#"Merged Group",{"Status"},tbStatus,{"Status"},"Merged Status",JoinKind.Inner),
#"Removed Columns" = Table.RemoveColumns(#"Merged Status",{"tbGroup", "Merged Status"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Status", type number}})
in
#"Changed Type"
Load To as connection only, and tick Load to Data Model
Now create a DAX measure:
Status Sum:=SUM ( 'Filtered Data'[Status] )
You can then use the following formula on your worksheet, to get the Sum of Status values, for rows matching the criteria specified in the Group and Status tables:
=CUBEVALUE("ThisWorkbookDataModel","[Measures].[Status Sum]")
Simply refresh the data connection to update the value.

Resources