I have an excel sheet containing some data, i.e. main sheet. How can I automatically transfer the fields that contains the same value for a specific column, i.e. here A, in the main sheet to another sheet.
Please take a look at this example:
this the main sheet:
A B C D
1 Smith 100 Mar 1
2 Bob 95 Apr 5
3 John 34 Aug 4
4 Bob 88 mar 7
5 John 7 Apr 4
Let's say column A is the reference column for sorting. We want all fields containing the same value in A to move to a separated sheet. The same for other duplicate values of A is also expected.
The result should be :
Sheet 1:
A B C D
1 Bob 95 Apr 5
2 Bob 88 mar 7
Sheet 2:
A B C D
1 John 34 Aug 4
2 John 7 Apr 4
Sheet 3:
A B C D
1 Smith 100 Mar 1
If possible I want this method to be up-to-date, as if a row is removed in the main sheet, the change applies in the corresponding sheet.
You can either:
1) duplicate the data in the sheets with sheet2(cell) = sheet1(cell) references for each sheet. Then having a filter on for each new sheet for column as wanted value.
2) write a VB script, possible triggered by the worksheets(main data) onChange function monitoring that data range, and copying the rowns to new WSs.
3) make a new pivot table for each "additional" sheet where you can configure the data you want to show
implementation kinda depends on if you want to keep the data "up to date" like if there is a row deletion in main data should it be removed from other sheets etc. but simple one time copy would be code like(not actual syntax but just pseudocode):
sub Worksheet_Change(range)
if range in wnated range
copy entire row from sheet (data) to sheet X (sheet X will be chosen depending on value of column A)
Related
I have a Sheet in which i import daily a CSV of reporting containing a column which contains comma separated values containing locations and a value
Item ID
Location results
112
Location A :1;Location B:3;Location C:4;Location D:1
113
Location A :5;Location F:1;Location X:9;Location Z:1
116
Location AA:3
I need to generate report in google datastudio that looks like showing the value after the : of that specific location. And i don't want to make too many manual changes every time to every sheet in Gsheets, so i hope that datastudio formula can solve this for me.
Another issue is that the Location names need to be an exact match as some names contain similar words like "Brussels North", "Brussels", "Antwerp North"
The news item ID is unique for each row
Any idea how i can get this data in datastudio?
Thank you
Tom
In Excel i got this to work via =IFNA(VLOOKUP($D$2:$D$7,TRIM(TEXTSPLIT(INDEX($B$2:$B$100,MATCH(E1,$A$2:$A$100,0)),":",";")),2,0),"")
I would need a view like this
Results view
Location
112
113
116
Location A
1
5
0
Location B
1
0
0
Location AA
0
0
3
Here's one approach:
as shown in the screenshot you can paste the raw csv import data in columns A, B
the arrayformula in D2 arranges the data that's compatible with the expected output in data studio
D2 formula:
=QUERY(ARRAYFORMULA(SPLIT(FLATTEN(A2:A&"|"&BYROW(B2:B,LAMBDA(hx,SPLIT(JOIN("",BYCOL(SPLIT(hx,";"),LAMBDA(ax,REPT(TRIM(REGEXEXTRACT(ax,"(.*):.*$"))&"|",--REGEXEXTRACT(ax,":(\d+)$"))))),"|")))),"|",0,0)),"Select * Where Col2!=''")
Connect columns D, E to data studio
Create pivot table with
Location as Row dimension
Item ID as column dimension
Item ID in metric with COUNT as aggregation
I have large number of rows of data in Excel where I need to change the row array of the formula for every 3 rows but I can't figure out how to adjust the formula without an error.
How do I add a formula like this to the formula below?
=INT(((ROW(a1)-1)/11))*1+1
This is the formula I have been using, but I need to change it for every 3 rows.
=IF(COUNTIF($N$4:$N$6, ""), "",MAX($N$4:$N$6))
=IF(COUNTIF($N$7:$N$9, ""), "",MAX($N$7:$N$9))
And so on
Example
I have 3 approvers, if "product" is approved, the date is for the approval date of last said approval, if no approval has been made then the cell is blank. Outcome is what I want to collect from column 3 when product was approved from all 3 approvers which is the newest date of the 3 rows, if one approver has not approved, then I'd like column 4 to be blank.
Product
Approvers
Dates
Outcome
A
1
04.01.2016
04.01.2016
A
2
17.12.2015
04.01.2016
A
3
21.12.2015
04.01.2016
B
1
11.04.2017
11.04.2017
B
2
30.01.2017
11.04.2017
B
3
04.04.2017
11.04.2017
C
1
C
2
13.10.2016
C
3
14.02.2017
D
1
01.03.2022
01.03.2022
D
2
02.12.2019
01.03.2022
D
3
30.01.2020
01.03.2022
Picture of data
Two options:
To answer the original question, to make your formula change every n rows, use =-MOD(ROW()+c, n) to adjust this (where 'c' is a constant just to get them in line, if your data starts on row 2 then c would be 1).
Your formula for row 2 would be:
=IF(COUNTIF(OFFSET($N2,-MOD(ROW($N2)+1,3),0,3),""),"",MAX(OFFSET($N2,-MOD(ROW($N2)+1,3),0,3)))
Another option, not as direct an answer to the question but potentially useful if the number of products changed in future from 3 to something else, would be:
=IF(COUNTIFS(L:L, L2, N:N, ""), "", MAX(IF(L:L=L2, L:L)))
and click Ctrl+Shift+Enter after typing that in (because it's an Array formula, see here, here and here).
The advantage of this approach is that it looks at all rows where the product column is the same (I'm assuming unique products), so no need to limit it to 3 rows per product or have those 3 rows next to each other.
Activity
Employee
Week of May 17
Week of May 24
Inbox
Alice
3
4
Inbox
Jane
5
8
Alpha Project
Alice
10
3
Beta Project
Francis
7
5
Chi Project
Jane
4
3
I've attempted to use conditional formatting, arrays & Vlookups and unable to cleanly get the following end result.
The End result is to flag anybody working > 10 hours for a given week.
Table is above.
End result should change the color of a cell titled "Alice" outside of this table because Alice worked 13 hours during Week of May 17.
End result should change the color of a cell titled "Jane" outside of this table because Jane worked 11 hours during Week of May 24.
Francis worked 10 hours or below, so no action is needed.
Any help on this is much appreciated --
Create a condition with the following formula:
=SUMIF(B2:B6,F2,C2:C6)>10
Where B2:B6 is the column of Employee names, F2 is the cell you want coloured, and C2:C6 is the column of the May 17th week
My data/table that appears in the details section is pulled from SQL.
It essentially is a basic table with Row Names in column 1 and dates going across row 1 with the final column being a summation of the data.
The data is 4 rows long and what I am looking to do is create a field that I can put in the report footer that will display the same information as any one of the individual fields that is displayed in the totaled column (last column) of the table / details section.
For example if the 3rd row totaled 12 (in the details section of the report), I would like to create a standalone field that will display the 12 in the report footer.
The details section looks like a table: the report footer breaks out certain things from the details section. I need something that will allow me to reference the individual numbers in the details for example: only pull in the 18 or only pull in the 11 into its own little field on the report footer. Thanks.
Months 1 2 3 4 total
Jack 3 3 4 5 15
Will 4 7 5 2 18
Mike 1 3 3 5 12
Don 3 5 2 1 11
You need to manipulate by storing in the array and retriving one by one.
To store in array:
Create a formula #Total
Shared Numbervar array x;
x:=x+(total);
total
In report footer write one more formula #display
Shared Numbervar array x;
x[1] // first element in the same way 2,3,4 will give you all elements
Let me know in case any issue.
I've attempted using Pivot tables and SUMPRODUCT & COUNTIF formulas after looking through possible solutions but haven't found anything positive yet. Below is the input data:
Level 1 Level 2 Level 3 Level 4 Level 5
Tom Liz
Tom Liz Mel
Tom Liz Dan
Tom Liz Dan Ian
Tom Liz Dan Ken
Tom Tim
Tom Tim Fab
Tom Tim Fab Ken
Tom Tim Fab Ken Jan
Eve
Expected output data is below. The intent is to not have to feed in a pre-loaded list of names. The expectation is that the program could determine the counts based on the input data alone:
Counts
-------
Tom: 9
Eve: 1
Liz: 5
Tim: 4
Mel: 1
Dan: 3
Fab: 3
Ian: 1
Ken: 3
Jan: 1
Any help towards this is appreciated....thanks!
UPDATE: A preloaded list with the list of Names CAN be used to generate the counts. The above description was updated accordingly.
First enter the following UDF in a standard module:
Public Function ListUniques(rng As Range) As Variant
Dim r As Range, ary(1 To 9999, 1 To 1) As Variant
Dim i As Long, C As Collection
Set C = New Collection
On Error Resume Next
For Each r In rng
v = r.Value
If v <> "" Then
C.Add v, CStr(v)
End If
Next r
On Error GoTo 0
For i = 1 To 9999
If i > C.Count Then
ary(i, 1) = ""
Else
ary(i, 1) = C.Item(i)
End If
Next i
ListUniques = ary
End Function
Then hi-light a section of a column, say G1 thru G50 and enter the Array Formula:
=listuniques(A2:E11)
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.
If done correctly you should see something like:
Finally in H1 enter:
=COUNTIF($A$2:$E$11,G1)
and copy down
NOTE
User Defined Functions (UDFs) are very easy to install and use:
ALT-F11 brings up the VBE window
ALT-I
ALT-M opens a fresh module
paste the stuff in and close the VBE window
If you save the workbook, the UDF will be saved with it.
If you are using a version of Excel later then 2003, you must save
the file as .xlsm rather than .xlsx
To remove the UDF:
bring up the VBE window as above
clear the code out
close the VBE window
To use the UDF from Excel:
=myfunction(A1)
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx
and for specifics on UDFs, see:
http://www.cpearson.com/excel/WritingFunctionsInVBA.aspx
Macros must be enabled for this to work!