I am trying to find out the top 3 customers from a list.
I want to do this based on the number of orders.
At the end I would like to be able to display the following values:
Client
Amount of Orders
Summed Amount of Ordervalue
A
4
1.400€
D
3
1.200€
C
2
400 €
My output table is like the following just with way more clients
Client
Order type
Amount per Order
A
Container
300 €
A
Container
300 €
C
Trucking
200 €
B
Storage
100 €
A
Trucking
400 €
A
Trucking
400 €
D
Container
600 €
C
Trucking
200 €
D
Container
300 €
D
Container
300 €
You may use below formula.
=QUERY(A1:C,"select A, count(A), sum(C)
where A is not null
group by A
order by count(A) DESC
limit 3")
Try following query
Select Client,Count(Client) 'Amount of Orders',Sum(Amount) 'Summed Amount of
Ordervalue' From OrderDetails Group By Client
try following
Select Client,Count(Client) 'Amount of Orders',Sum(Amount) 'Summed Amount of
Ordervalue' From OrderDetails Group By Client
Related
I am working with some data in google spreadsheets, but I'm having problems with vlookup. I'm trying to get the district of an adress by the name of the street and the house's number. The problem is that vlookup stops on the first row, and some streets are so big that they below for more than one district.
In this example, i want to do a vlookup that returns the district D if my adress is street A number 15. Can someone help me? thanks.
Street
Start_Number
End_Number
District
A
0
10
C
A
11
20
D
B
0
10
C
Try QUERY() instead of VLOOKUP():
=QUERY(A:D, "
SELECT
D
WHERE
A = 'A'
AND B <= 15
AND C >= 15
LABEL
D ''
", 1)
Swap out the 'A' and 15 with cell references if you want it to be dynamic.
I work on a google sheet, where I should see the number of holidays per day for each team.
The table looks like this:
[table]
A
B
C
D
E
1
Employee Name
Team Name
01/03/2022
02/03/2022
03/03/2022
2
Employee 1
Team A
hol
hol
hol
3
Employee 2
Team B
early
early
early
4
Employee 3
Team A
hol
late
late
5
6
Team A
7
01/03/2022
8
RESULT HERE
I want to have a result that tells me that Team A had on 01/03/2022 2 holidays.
=countif(query(A1:E4,"select C where B contains '"&A6&"'" ),"hol")
A6 contains the team I am looking for.
A7 contains the date I am looking for.
A8 should show me the number of hol.
Currently, I have a fixed column to look inside which is "C". I want to replace that with the date from A7 - How do I do that?
I tried to play around with transpose and filter but had success.
try:
=COUNTIF(FILTER(FILTER(C2:E4, C1:E1=A7), B2:B4=A6), "hol")
Use XMATCH to get the Col number for QUERY and count inside query instead of COUNTIF:
=QUERY(
{B1:E4},
"Select count(Col1)
where Col"&XMATCH(A7,B1:E1)&"='hol'
and Col1='"&A6&"'
label count(Col1) ''",
1
)
For example I have this list of a product and a price:
Product
Price
potato masher
€ 27
dish brush
€ 20
rolling pin
€ 17
doormat
€ 20
mop
€ 22
To choose a random product, I use =INDEX($A$1:$A$5,RANDBETWEEN(1,COUNTA($A$1:$A$5)),1)
Is there a formula or way to randomly choose from two adjacent columns and put it in two other columns? So when it randomly chooses the potato masher, it chooses € 27 for the adjacent row and not for example another random price from that column (Which happens when I use the =INDEX with B instead of A).
Assuming you don't have Microsoft365:
Select two cells, e.g: D1:E1.
Use formula =INDEX(A2:B6,RANDBETWEEN(1,5),0).
Confirm through: CtrlShiftEnter.
If you do have MS365, you don't need to CSE-confirm this.
use:
=INDEX(A1:B6, RANDBETWEEN(1, COUNTA(A1:A6)))
I currently have a table with five columns:
A = Campaign
B = Person
C = Opportunity Name
D = Total Cost of Campaign
E = Date
I'm trying to use =sumifs to calculate the amount in column D only if: (1) it matches the exact value in cell H2 to column A, (2) the date range, in column E, is greater than the value in cell I2, and (3) it removes duplicates based on value in column C (so you can't sum if value appears more than once).
Please refer to my data table (also attached) as reference:
Campaign Person Opportunity Name Total Cost of Campaign Date
A Bob Airbnb 5000 3/2/2017
B Jim Sony 10000 3/2/2017
B Jane Coca-Cola 10000 3/2/2017
C Jim Sony 200 3/2/2017
B Daniel Sony 10000 3/2/2017
B April Coca-Cola 10000 3/5/2017
How could I do this?
Thanks in advance for the help!
Try:
=SUM(
UNIQUE(
QUERY(A:E,"select C, D where A = '"&H2&"' and E > date '"&TEXT(H3,"YYYY-MM-DD")&"'")))
Query will cut first two conditions. Unique will remove duplicates:
I am running a Nerf league at a party and want my spreadsheet to show the top five contestants.
Contestants are allowed unlimited entries and only their top score is counted. Entries are being collected on Google Sheets and The Top 5 published on a kiosk screen.
Here is some sample data:
- **Full Name,Score**
- Test Test,3
- Test2 Test2,1
- Test3 Test3,10
- Test4 Test4,3
- Test5 Test5,42
- Test5 Test5,500
- Test6 Test6,20
Here is the formula I have so far (with thanks to tigeravatar):
=INDEX($A$2:$A$28,MATCH(1,INDEX(($B$2:$B$28=LARGE($B$2:$B$28,ROWS(I$1:I1)))*(COUNTIF(I$1:I1,$A$2:$A$28)=0),),0))
This formula shows all maximum values - if, for example, one person has 5 entries that are higher than everyone else, they will all be counted.
The "top five" must show only the entry with the most points from five different contestants.
What do I need to do to show only the top entry that each contestant has provided?
Seems that the formula offered by #AdamL met the requirements:
=QUERY(A2:B28,"select A, max(B) group by A order by max(B) desc limit 5 label max(B) ''",0)
=QUERY(A2:B28,"select A, max(B) group by A order by max(B) desc limit 5 label max(B) ''",0)
<=
It works without a case.
if you have special character in cells in col A, the output/result of function is not right.
For example,
if value in A1 is HN_123_1/2, the output is not right. The special character here is "_" and "/".
Hope this help.