Looker Case Study - alias

I have a google survey with multiple answers that resulted in data on a google sheet to have columns with comma-separated values
col1
A
A,B
A,C
B,C
C,D
I want one chart on google looker studio that turns counts of A, count of B count of C and count of D.
I have tried this solution already and it didn't not work
CASE
WHEN CONTAINS_TEXT(col1, "A") THEN "A"
WHEN CONTAINS_TEXT(col1, "B") THEN "B"
WHEN CONTAINS_TEXT(col1, "C") THEN "C"
WHEN CONTAINS_TEXT(col1, "D") THEN "D"
END
The chart is to be controlled by other demographic columns, like gender, age group, Location, etc..

Related

Marking repeating or both in corresponding cell based on the criteria

i have a sheet in excel which have two columns Col "A" & Col "B"
in col "A" i have values like 1,1,1 - 3 times & 2,2,2,2 - 4 times
and in col "B" i have yes, yes, yes corresponding to column A value 1,1,1 &
yes, no ,yes no corresponding to column "A" value 2,2,2,2 as shown in the image.
now i want to add some values in col "C" based on codition like
if col "A" 1,1,1 all values are yes in col "B" then put SOME TEXT LIKE "repeating" in Col "C" in front of every value of col"A"
and if col "A" 2,2,2,2 all values are different like yes, no, yes , no in col "B" then put SOME TEXT LIKE "both" in Col "C" in front of every value of col"A"
for example see below image.-
-it will check all the similar values in col "A" First suppose it will take "1" first then it will check its corresponding value in col "B" and it will keep on checking all of the values of "1" in col"B" if all values are "yes" then it will simply put "repeating" in col"C" in front of every "1"
-but again it will check for all the values of "2" in col"B" if all values are "yes" then it will simply put "repeating" in col"C" in front of every "2" but as you can see all values are not same in front of "2" some are "yes" and some are "no" in col"B" so if all values of "2" are not same in col "B" then it will put "both in col"C" in front of every "2"
i want to know is there any formula for doing this or vba code is needed . please help me regarding this.
If you have Excel 2016 you can use COUNTIFS nested in an IF like:
Countifs will count the values based on two criteria.
=IF(COUNTIF($A$1:$A$7,A1)=COUNTIFS($A$1:$A$7,A1,$B$1:$B$7,B1),"Repeating","Both")
You can nest a third condition like this:
=IF(B1="may be","Confirm",IF(COUNTIF($A$1:$A$9,A1)=COUNTIFS($A$1:$A$9,A1,$B$1:$B$9,B1),"Repeating","Both"))
Explanation:
The formula consists of two conditional IFnested:
The first IF(B1="may be","Confirm" evaluates if B1 = "may be" when is
true it returns "Confirm".
when is false start the second IF to compare one condition:
COUNTIF($A$1:$A$9,A1) - Countsif function counts values in a range
based on one condition. In this case, the criteria are each cell in
column A and count how many times are this value in the range
$A$1:$A$9.
COUNTIFS($A$1:$A$9,A1,$B$1:$B$9,B1) - Countifs function counts
values in a range based on multiple conditions. In this case, it is
counting based on two criteria for each value in A and B.
Evaluating second conditional:
For C1:
COUNTIF($A$1:$A$9,A1) = 3 3 times the value (1) in the range
$A$1:$A$9.
COUNTIFS($A$1:$A$9,A1,$B$1:$B$9,B1) = 3 3 times the values (1) and (yes).
So, if 3 = 3 then "Repeating".
For C4:
COUNTIF($A$1:$A$9,A4) = 4 4 times the value (2) in the range
$A$1:$A$9.
COUNTIFS($A$1:$A$9,A4,$B$1:$B$9,B4) = 2 2 times the values (2) and (yes).
So, if 4 = 2 is false it returns "Both".

VBA code to sum total of like account numbers

I have a code that matches 2 columns A VS C for like account numbers. If numbers match than it finds if the amounts in Column B & D match. If it does it pastes the lines of data to another spreadsheet.
I am coding a statement to find the like account numbers in column A VS C, but if the amounts don't match in column B & D than it needs to find the like account numbers in column A and sum there amounts to see if it matches the amount in column B.
How would I write the code to collect the sum of the same account numbers in column A?
If Acct = MatchAcct Then
If Amount <> MatchAmount Then
If Acct = nonmatchacct Then
(sum the values in column B for the matched account #s in column A)
The code above says if the Acct (Column A account #'s) = MatchAcct (Column C account #'s) then if Amount (Column B value) doesn't equal MatchAmount (Column D value) then the code sees if Acct (Column A account #'s) equals nonmatchacct (any other account # in Column A). If the account # matches then I want it to sum those amounts in column B.

Search a range with 3 tables according to dropdown value

I'm quite new to macros/formulae of excel. I have a sheet (Sheet1) exported which has the approvers list.
I also have 3 tables ( A, B, C)
In Sheet2 which has like below values:
Table A: {aaa,bbb,ccc}
Table B: {xxx,yyy,zzz}
Table C: {d12,e12,c12}
I need to search Column Q in sheet1 with either one table as per the dropdown menu.
If I select Table A, then I need to have all rows with text aaa OR bbb OR ccc in Column Q. I used the below formula, but I can search only one table at time.
I can't select through dropdown menu.
=SUMPRODUCT(--ISNUMBER(SEARCH(A[ID],Q51)))>0
This returns true or false. I have to keep changing the formulae for each table. Can I do that through drop down menu.
Use INDIRECT : place INDIRECT(Right(myRange, 1) & "[ID]") in the place of A[ID].
myRange is the address of the cell where the drop-down is placed; i.e. could be D1 for example, and the formula becomes:
=SUMPRODUCT(--ISNUMBER(SEARCH(INDIRECT(Right(D1, 1) & "[ID]"),Q51))) > 0

Order 2 columns by matching to another column

I have 4 columns in an excel file:
The two on the right have about 9000 rows, the 2 on the left have about 14000.
Column A and B are connected. Also, C & D are connected.
The THER_CLASS column is the 1st 6 numbers of the key column.
How would I order the left two columns by if the 1st 6 of the key matches THER_CLASS?
I want each row to take the A column find which row the 1st 6 # of GPI are equal and then move C and D to the row that A is on.
I could do this by building a console app in c# but I feel like there is a way to to it much easier in excel.
You're basically just looking up the "Category" of each "Item". As Flephal points out, you can do this with VLookup.
Add a column E with the header "CLASS" and a column F with the header "CLASS_DESC".
For column E, starting with cell E2 and filling downwards, use the formula "=VLOOKUP(Left(C2, 6), A:B, 1, False)"
For column F, starting with cell F2 and filling downwards, use the formula "=VLOOKUP(Left(C2, 6), A:B, 2, False)"
Really, it would make much more sense if you didn't have the two tables mashed up next to one another and instead had each one on a different sheet. For example, move A & B to another sheet and call it "CLASSES".

Excel VBA Code to transpose multiple columns into multiple rows

Can somebody please help, i'm a newbie in VBA, i would like to thank you in advance for your help. If there are any links where my question has already been adressed please point me in the right direction. I have searched here and on other sites but i couldn't find anything that atleast get me started. I would like to create VBA code that loops through cells in every row and transpose them into seperate rows as illustrated below.
I have an excel spreadsheet with 12000 rows of data and multiple columns. For each row i have columns "A" to "Q" as static fields. Name, DOB, ID_Number, e.t.c. From columns "Q" to "DD", i have repeated data on "City" and "RegDate" columns, for example: City1, RegDate1, City2, RegDate2, City3, RegDate3,..& CityN, RegDateN. The City names are used as Headers and the data cells show "R" under every city where a person is registered and the registration date in the column next to it, otherwise there is no entry.
I would like to transform this data so that for every City where a person is registered, i will have a new row of data showing the static fields "A" to "P", "City", and "RegDate" i.e. after column "P" i will only have two columns "City" and "RegDate".
I'm really struggling with creating code that loops from Column Q to Column DD creating a new row when ever an "R" is encountered copying rows Columns "A" to "P" and inserting the Name of the City in the new column "Q" and the RegDate in the new Column "R", before moving on to the next row until all the 12000 rows have been transformed.
Any help to get me started would be greatly appreciated especially on setting up the looping that creates a new role for every record with an "R" encountered.
Have you considered just putting this information in two new columns to the far right (DE and DF)? Then you could either hide Q to DD, or delete those columns.
As for the looping code to do this:
Dim cr As Long 'current row
Dim cc As Long 'current column
For cr = 2 To 12000
For cc = 17 To 108 Step 2
If Cells(cr, cc).Value = "R" Then
'make column 109 (DE) in current row = city name
Cells(cr, 109).Value = Cells(1, cc).Value
'make column 110 (DF) in current row = date of registration
Cells(cr, 110).Value = Cells(cr, cc + 1).Value
End If
Next
Next