I have a table record customer buy commodity per day,
customer maybe buy it one time per day, or two times per day.
Date Customer spent
2022/5/31 Customer A 200
2022/5/31 Customer B 100
2022/5/31 Customer C 160
2022/5/31 Customer D 50
2022/5/30 Customer A 50
2022/5/30 Customer F 50
2022/5/30 Customer B 40
2022/5/30 Customer C 50
2022/5/30 Customer D 400
2022/5/30 Customer E 90
2022/5/29 Customer F 60
2022/5/29 Customer F 100
2022/5/29 Customer D 200
2022/5/29 Customer C 50
2022/5/29 Customer B 30.03
2022/5/29 Customer A 50
I would like to find out is this customer's first time or second time or third time come to shop to buy things.
For example, there are 4 customers(A, B, C, D) buy things first time at 2022/5/29.
And 1 customer(F) buy things first time and second time at 2022/5/29.
Hope Result
Date First Time Second Time Third Time
2022/5/31 0 0 4
2022/5/30 1 4 1
2022/5/29 5 1 0
sample google sheet
Many thanks.
Related
I'm working on a timetabling project on Google Sheets. I am making the student timetables at the moment.
There is a teacher overview sheet stating which teacher is in which room for which class. I am need a formula that can return a class code, room, and teacher in the period slot. Each period is a column.
The OVERVIEW sheet
MONDAY
Teacher Period 1 Period 2 Period 3 Period 4 Period 5
Teacher 1 07MA01 # BG01 08MA01 # BG01 09MA01 # BG01 10MA01 # BG01 11MA01
Teacher 2 11EN01 # B101 07EN01 # B101 08HU01 # B101 09EN01 # B101 10EN01 # B101
Teacher 3 08FR01 # B201 10FR01 # B201 07FR01 # B201 11FR01 # B201 09FR01 # B201
Teacher 4 FREE FREE 10GG01 # B102 08HU01 # B102 08HU01 # B102
The Student Timetable sheet
Student 1
Contact:
student1#example.com
Classes (input)
student1
Period 1
Period 2
Period 3
Period 4
Period 5
After School
08HU01
Monday
Teacher 1
Teacher 2
Teacher 4
Teacher 4
08MA01
FREE
08MA01
08HU01
08HU01
08HU01
BG01
B101
B102
B102
Tuesday
FREE
FREE
FREE
FREE
FREE
Wednesday
FREE
FREE
FREE
FREE
FREE
Thursday
FREE
FREE
FREE
FREE
FREE
Friday
FREE
FREE
FREE
FREE
FREE
The example sheet
On the student timetable sheet, the administrator can enter any class code in column I. For example, 08HU01 and 08MA01. The formula searches for Column I input matches in overview sheet and outputs it in the time slot exB3:B5
| B
----------------
3 | teacher
4 | class code
5 | room
I tried vlookup but it doesn't support searching for multiple values and ranges:
=VLOOKUP(I2:I3[other things],OVERVIEW!B3:F6,1,1)
Paste this formula in B3, B6, B9 B13 B15 and change the day table for day week.
=ArrayFormula(TRANSPOSE(SPLIT(TRANSPOSE(
LAMBDA(g, IFNA(BYCOL(B$2:F$2, LAMBDA(lr, TEXTJOIN(",",1,VLOOKUP(lr, g, {2,4,3},0)))), " ,Free, "))
(LAMBDA(fl, TRANSPOSE(SORT(TRANSPOSE(fl), SEQUENCE(COUNTA(QUERY({TRANSPOSE(fl)}, "Select Col1")), 1,1,1),0)))
(IFERROR(TRIM(SPLIT(FLATTEN(SPLIT(
LAMBDA(t, BYROW(I2:I, LAMBDA(q, TEXTJOIN(", ", 1 ,QUERY({t}, " Select * where Col1 = '"&q&"' ")))))
(LAMBDA(mr, { mr,IF(SEQUENCE(ROWS(mr), 1,1,1)="",,"+")})
(LAMBDA(y,
{ TRIM(SPLIT(LAMBDA(x, QUERY({x}, "Select Col3 "))
(y), "#")),QUERY({y}," Select Col2,Col1 ")})(SPLIT(FLATTEN(OVERVIEW!$B$2:$F$2&"+"&OVERVIEW!$A$3:$A$6&"+"&OVERVIEW!$B$3:$F$6),"+")))), "+")), ", ", 0)), "")))), ",")))
Phew, this didn't seem complicated at the beginning.
I have data that looks like this:
sku
price
level
ab1
1.01
1
ab2
2.06
1
ab2
1.45
25
ab3
2.00
1
ab3
1.40
10
ab3
0.89
25
ac2
0.74
1
ac2
0.50
100
As you can see, I have products that have quantity discounts in one sheet. I need to get these levels and prices out of this sheet and into another sheet.
I need to get all prices and levels for all skus, not just the first match. So if my lookup is for sku AB3 I would expect to find 2.00 / 1, 1.40 / 10 and 0.89 / 25
I have not got an extensive Google Sheets knowledge so I am afraid I have hit a brick wall in what to search for.
What do I need to do in order to get this data from sheet a into sheet b.
I have not yet decided how this data is going to look in sheet b, so I don't know if I want the price and level to go into the same cell like "1.01 per 25" or in separate cells.
You can use FILTER() function.
=FILTER(B2:C,A2:A=F1)
Or QUERY() function like-
=QUERY(A2:C,"select B, C where A='" & F1 & "'")
On one sheet I have a table of statistics similar to this:
A B C D
1 Teams MP GF GA
2 Team A 3 3 2
3 Team B 2 1 3
4 Team C 3 5 2
5 Team D 2 2 1
I then have some formulas that calculate an expected score between two teams set up like this:
A B C D E
7 Teams GF/G GA/G Avg Exp Score
8 Team 1 =VLOOKUP(A8,$A$1:$D$5,3)/VLOOKUP(A8,$A$1:$D$5,2) =VLOOKUP(...) =AVERAGE(...) =B8-C9+D8
9 Team 2 =VLOOKUP(...) =VLOOKUP(...) =AVERAGE(...) =B9-C8+D9
I then have a separate sheet that has the matchups between teams like this:
A B C
1 Date Matchup Exp Score
2 11/15 Team D =FORMULA(
3 11/15 Team B =FORMULA(
4 11/16 Team C =FORMULA(
5 11/16 Team A =FORMULA(
6 11/17 Team B =FORMULA(
7 11/17 Team C =FORMULA(
8 11/17 Team D =FORMULA(
9 11/17 Team A =FORMULA(
My question is if there is some kind of formula that can take the teams in the matchup, copy and paste them behind the scenes into cells A8 and A9, and spit out the Exp Score that would generate in E8 and E9. Is this something that is possible to do in Google Sheets or does it have to be manually copied and pasted into the cells and then copy and paste the results to where I want them?
I've put your formulas together, and come up with the following result, but I think possibly your logic for the average is a little bit off.
Should it not be:
=SUM(C2:C5) / SUM(B2:B5) /2
So the sum of all the goals scored divided by the total number of matches (number of times any team played divided by 2)? This gives the averages goals per game, and then your other formulas add a positive delta to the team with the stronger GF/G, and a negative delta to the team with the weaker GF/G.
Also, your data may not be valid. Shouldn't the total number of goals scored BY all teams, also equal the total number of goals scored AGAINST all teams? So the sum of column C must equal the sum of column D? I therefore changed the numbers in column D slightly.
The result then for your data looks like this:
where the formula in E1 is:
=ArrayFormula({"GF/G";C2:C5/$B2:$B5})
and in G1 is:
=ArrayFormula({"Avg Goals/G";SUM($C$2:$C$5) / (SUM(B2:B5)/2) })
Adding in your matchups and projected scores, I get this:
where the projected scores for all the teams in column I are given by this formula, in K2:
=ArrayFormula(vlookup(I2:I7,$A$2:$G$5,5)
- vlookup(J2:J7,$A$2:$G$5,5)
+ $G$2/2)
Note that I've duplicated columns K:M in columns N:P, but shown with a decimal place to show the average goals per game still equals 2.2, but with rounding adjustments (no fractions of a goal) it doesn't always work out right.
Here is my sample sheet.
I have 2 different Google Sheets. Master Sales & Projections. On Master Sales I have 2 columns, Expected & Billed which has data broken down by billing weeks.
I need Sheet 2 to grab the data from the cell that not 0 since we are trying to track total sales for the month (expected & actual) and then at the end of the month we would have the real billed numbers.
Potato example below
Sheet 1
A B
1 Expect Billed
2 $123 $145
3 $145 $155
4 $156 $0
5 $132 $0
What Sheet 2 should look like
A B
1 Week1 $145
2 Week2 $155
3 Week3 $156
4 Week4 $132
Assuming you will arrange for the week numbers, in B1 please try:
={query(Sheet1!A2:B5,"select B where B<>0",0);query(Sheet1!A2:B5,"select A where B=0",0)}
I need a SUMIFs equivelent in google spreadsheet. It only has SUMIF, no IFS.
here is my data:
# Salesman Term (Month) Amount
1 Bob 1 1,717.09
2 John 1 634.67
3 Bob 1 50.00
4 Bob 1 1,336.66
5 Bob 1 0.00
6 Bob 1 55.00
7 Bob 300 23,803.97
8 Bob 300 24,483.91
9 Bob 300 20,010.03
10 Bob 300 41,191.62
11 Bob 300 40,493.14
12 Bob 300 10,014.01
13 John 1 100.00
13 John 100 100.00
I want to add everything that BOB sold that the term is equal to or less then 100. I also want to SUM everything that bob sold that the term is greater then 100. Same for John.
You need to use the FILTER function combined with the SUMfunction. In your example with Bob, your function would be like (assuming your data columns is from A to C):
=SUM(FILTER(C:C;A:A="Bob";B:B<=100))
The new Google Spreadsheet, now has the SUMIFS function available.
You can use the following formula:
=SUMIFS(F1:F14,D1:D14, "=Bob",F1:F14, ">=100",E1:E14, "<100")
If you want to perform the calculation for John as well, I can recommend the following:
=QUERY(D1:F14, "SELECT D, SUM(F) WHERE E<100 AND F>=100 GROUP BY D LABEL D 'Who', SUM(F) 'Total'")
See example file I created: SUMIFS on DATA