Not sure how to title this one... So please forgive me.
What we have is a POS sheet, I import POS data from Distributors then given the zipcode value it sorts the info and populates other sheets within the doc for each person responsible for the sale.
Sheet2 is the main POS sheet where all the data is imported into.
Rep Template is the sheet for any given rep responsible for the sale.
The Rep Template contains again a list similar to Sheet2 but only sales that apply to them (thanks to the zip code formula Im using). I However have on problem in this Rep Template. Im using a QUERY eg
=query(index(A19:F); "select (month(Col1)+1),sum(Col4), (sum(Col4)*.05) where Col1 is not null group by (month(Col1)+1) label (month(Col1)+1) 'MONTH',sum(Col4) 'TOTAL SALES',(sum(Col4)*.05) 'COMMISSION EARNINGS' ")
***See the highlighted yellow section #L9
This works fine
Q.What I would like to do is add this to it
but I cannot use (sum(D)*.05) again for another column...
=query(A19:F, "select (sum(D)*.05) where F != 'N' group by (month(A)+1) label (sum(D)*.05) 'ADJUSTED COMMISSION EARNINGS' ")
***see the highlighted orange section #N3
(Also why is this skipping down one cell that could solve a lot)
The thing is some commission for reasons xyz may be omitted once verified (hence F19:F) an "N" in COLUMN F will omit that line from the commissions resulting in adjusted commissions earnings.
Here is my Spreadsheet
https://docs.google.com/spreadsheet/ccc?key=0AqZjzFwBse-sdGZ4M3ppWVBuNTdJV3dYbGlwb0NUeVE&usp=sharing
Thanks everyone ; )
Please change Col1=A and Col4=D, it is right
use double-query:
=QUERY(QUERY(A19:F,
"select sum(D)
where F != 'N'
group by month(A)+1
label sum(D)''", ),
"select Col1*.05
label Col1*.05'ADJUSTED COMMISSION EARNINGS'")
Related
Let's say I'm collecting reviews on fruits, people submit a google form about a fruit's name (eg. "apple") and its score. This is on sheet 1. let's say the submissions of the fruit names are on col B.
On sheet 2, i have a column (lets say col A) of all fruits (apple, pear, etc)
I would like to add a column on sheet 2 (lets say col B) that asks if there is a review for that fruit. How do I do that?
Goal: select cell from col A (list of all fruits) -> search within col B on sheet 1 to see if someone submitted a review of that fruit -> if text matches, return "Y" and if it does not exist/otherwise, return "N"
Sorry if this sounds super complicated!
I tried using vlookup but i think the "range" part stumped me. also tried if and search but not sure ;-; I don't want to have to input the fruit's name manually every time. I think i'm also having trouble as it's on two different sheets (not two completely different Google Sheets, but two sheets within one Sheet. if that makes sense)
To get a true/false answer, use this formula in row 2 of a free column in Sheet2:
=arrayformula( if( len(A2:A), not(iserror(match(A2:A, 'Form Responses 1'!B2:B, 0))), iferror(1/0) ) )
But it would probably be simpler to just list all fruit and count them:
=query('Form Responses 1'!A1:C, "select B, count(B) where B is not null group by B", 1)
I have a list of email addresses in one sheet (first column).
I have a list of transactions in another sheet with emails and sale amounts.
I am looking for a formula that adds up all the transaction $ sales for any transactions made by the people (emails) in the first sheet.
Any help would be much appreciated!
Your sample data is very limited (only one row matching one person, in fact). But the following formula should work for you. Place it in a new sheet, in cell A1:
=ArrayFormula(IFERROR({"Name","Total"; QUERY(FILTER(Transactions!A2:D,NOT(ISERROR(VLOOKUP(Transactions!A2:A,Tags!A:A,1,FALSE)))),"Select Col2, SUM(Col4) GROUP BY Col2 ORDER BY Col2 LABEL SUM(Col4) '' ")},"No Data"))
This one formula will produce the headers (which you can change within the formula itself as desired) and all results.
FILTER filters in only 'Transactions' data (names through amounts) where the emails are found in the 'Tags' sheet.
Then QUERY returns the name and totals for each match in alphabetical order by name.
If there are no matches, "No Data" will show instead.
If I understood your question correctly!
Try this on the sheet, where you only have emails and wanted to get sum of sales amount
=sumifs(range_whichHasTransaction , range_of_Email_inThat_TransactionsTable , Cell_Reference_ofEmail_forWhich_you_want_sum_the_Transaction_Amount)
it will Look something like this:-
sumifs(TransactionSheet!B:B,TransactionSheet!A:A,Emails!A2)
Reference
SUMIFS
community!
I have a table of 3 columns in Google Sheets: Date, Name, Amount.
I want to process data from it, so for every date in the list, there will be a full list of participants and amounts.
If there is no amount for specific date and person, it will be "0", or just leave it blank.
In addition, would like to count the percent of the sum of the amount for each person till the date in the corresponding row.
And it should be dynamically updated, so if a new row added with new name or date or both, so new participant will be added to every date in the output table and new full list of participants for the new date created.
For better understanding, here is the example of the data and output tables
What I've tried?
In MS access query it could be done not so hard.
Here I tried to create 2 new lists of unique dates and participants and connect them through use of CONCATENATE, ARRAYFORMULA, then SPLIT and some QUERY. All this through use of helping column of text, which should be edited manually for every new row...
The code in helping column:
=concatenate(arrayformula(if(isblank($F$3:$F),,";"&$E3&","&$F$3:$F)))
Then split code:
=query(arrayformula(split(transpose(split(TEXTJOIN(";",true,$G$3:$G),";",true,true)),",",true,true)),"Select Col1,Col2 where Col2 is not null order by Col1 ASC",0)
But here I stuck...
Want to pull the amounts for every corresponding date and participant, but...
FILTER reaches first, not existent in the original table combination, and doesn't proceed.
QUERY doesn't fetch the data fully automatically for all the list in the output table.
VLOOKUP gives only one row or complete mess, when use it recursively, or error...
So, how can I do this (if it's possible at all) in google sheets, and so all the output will be fully automatically updated?
Thank you very much!
Update - based on comments
I could not figure out a way to make this through one formula. If this works, you can have a hidden column (say H here) that totals the amount for the person till that date using the formula =QUERY(FILTER($E$3:$G, $F$3:$F = F3, $E$3:$E <= E3), "select sum(Col3) label sum(Col3) ''", 0) in H3.
Then in I3 you can find the % of total till date using the formula =QUERY(FILTER($E$3:$G, $F$3:$F = F3, $E$3:$E <= E3), "select sum(Col3) label sum(Col3) ''", 0)/SUMIF($E$3:$E, E3, $H$3:$H).
Both of the formulae in H3 and I3 need to be dragged down unlike the one in E3. Perhaps someone will be able to offer a better solution.
Previous answer
You can try something like this:
In E3 you can have the formula =ArrayFormula({(FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦"))), (TRANSPOSE(SPLIT(REPT(JOIN("", FILTER(UNIQUE(B3:B)&"◼︎", UNIQUE(B3:B)<>"")), (COUNTA(UNIQUE(A3:A)))), "◼︎"))), (IFNA(VLOOKUP({(FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦")))&(TRANSPOSE(SPLIT(REPT(JOIN("", FILTER(UNIQUE(B3:B)&"◼︎", UNIQUE(B3:B)<>"")), (COUNTA(UNIQUE(A3:A)))), "◼︎")))}, {A3:A&B3:B, C3:C}, 2, 0), 0))}). It is a little long but fills Columns E through G dynamically.
Then in H3 you can have the formula =ArrayFormula(IFERROR(((IFNA(VLOOKUP({(FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦")))&(TRANSPOSE(SPLIT(REPT(JOIN("", FILTER(UNIQUE(B3:B)&"◼︎", UNIQUE(B3:B)<>"")), 3), "◼︎")))}, {A3:A&B3:B, C3:C}, 2, 0), 0))/(SUMIF((FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦"))), (FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦"))), G3:G))), "")). This one is dynamic as well.
I tried with your data and added a row on my own and it works.
I have a Google Sheets Document with 2 Sheets, Inventory and Pending Transactions.
My goal is to create a new sheet with Available items.
Company,Item,Quantity
Walmart,ToyA,100
Walmart,ToyB,5
Amazon,ToyA,2000
Amazon,ToyB,100
Amazon,ToyC,5
----
Company,Item,Pending
Walmart,ToyA,2
Walmart,ToyB,4
Amazon,ToyA,1990
My idea is to Join the Items together.
Company,Item,Inventory,Pending,Available
Walmart,ToyA,100,2,{Computed}
Walmart,ToyB,5,2,{Computed}
Amazon,ToyA,2000,1990,{Computed} # All of the {Computed is Inventory minus Pending}
Amazon,ToyB,100,2,{Computed}
Amazon,ToyC,5,2,{Computed}
My Original idea was to Show the items merged on a Primary key of Company:Item, but i have no problem creating a new sheet which handles all of this. I was trying to do things like: =Query({Sheet1!A:D;Sheet2!A:D}, "select *") but that appends Sheet2 to the End of Sheet1, which is not what I wanted.
I got stumped, and after looking at a bunch of different Questions I couldnt find the example I was looking at.
To merge the items without blank rows, use
={QUERY(Sheet1!A2:D, "SELECT * where not A like '' ");
QUERY(Sheet2!A2:D, "SELECT * where not A like '' ")}
if you want to know from which sheet the data are coming, use
=QUERY({
ARRAYFORMULA({IF(ISBLANK(Sheet1!A2:A),,"#1") ,Sheet1!A2:D});
ARRAYFORMULA({IF(ISBLANK(Sheet2!A2:A),,"#2") ,Sheet2!A2:D})
},"select * where Col1 <> '' ")
I have a sheet with the following columns:
Column 1: contains text of the form "TS001", "TS002", "DR001", "MS002" etc.
The 2 letter in the beginning are a code for the manufacturer name, so for example "MS=Microsoft".
For the second column, I would like to have a formula that goes through the first column and searches for those letters, in order to then return the complete name of the manufacturer.
For example, it should look something like this:
Column 1
Column 2
MS001
Microsoft
TS002
Tesco
DR001
DR. Pepper
TS003
Tesco
Is something like that possible?
Thank you very much!
When you say "MS=Microsoft" it implies somewhere you have a table with that reference. For the purposes of the following example I created a sheet named ReferenceTable where column A contains the two letter code, and column B contains the name of the company. So it looks like this:
A
B
MS
Microsoft
TS
Tesco
And now in the main sheet in column B you would write the following formula:
=ARRAYFORMULA(VLOOKUP(MID(A1:A,1,2),ReferenceTable!A1:B,2,FALSE))
This will give you the name of the company, looked up from the reference table.
The array formula is there so that you only have to put this formula in cell B1, and assumes you will use the ReferenceTable sheet as a list; that way as you add records to Column A Column B is populated by the arrayformula in B1.
I'd simply use a Reference Table and a VLOOKUP formula
If cell B7 contains "MS0001"
the following formula will attempt to match just the first two letters again a reference table located in cells O7:P9
=VLOOKUP(MID(B7,1,2),O7:P9,2,FALSE)
and will return "Microsoft" when it finds "MS"
In order to achieve what you want, somewhere you need to have a list of the two letter codes and the corresponding company name.
As with all vba, there’s any number of ways to do this, but I would probably put the two letter code and company data into an array, then iterate through col1 to create the desired output for col2.
E.g below assumes the two letter code and company names are in col3 and col4 respectively, but you can change it to wherever they’re located.
Sub CompName()
Dim Cmpname () as string
Dim col1 as range, rng as range
Cmpname = range(range(“C1”), range(“D1048576”).end(xlup))
Set col1 = range(range(“A1”), range(“A1048576”).end(xlup))
For each rng in col1
For i = lbound(Cmpname, 1) to ubound(Cmpname, 1)
If left(rng, 2) = Cmpname(i, lbound(Cmpname, 2)) then
rng.offset(0,1) = Cmpname(i, ubound(Cmpname, 2))
Exit For
End if
Next
Next
End Sub
I’ve admittedly just written this on my phone and have not tested it, but hopefully there’s minimal mistakes.
I just reread your question and realized that you may actually want a formula rather than vba code.
If this is correct, using an INDEX MATCH is probably your best bet.
In this example I’ll assume the same setup as described above - col3 has company codes and col4 has company name - and this formula can be inserted into cell B1:
=index(D:D,match(left(A1,2),C:C,0))
You can then just filldown for the rest of the entries in col2.
Again, done from memory without testing so hopefully got it right.