I have a column that goes from trip 01, trip 02, trip 03... up to trip 50, next to that column there will be an indicator where the current trip is, for example if is in line where is the trip 06, I want to create a helper column that will show trip from 01 up to current trip which is trip 06 and add trip 07 to it, in other words list all previous trips until current one and also next trip. Any thoughts?
I have a spreadsheet where I have been doing tests.
Spreadsheet
Would this be useful? It lists from A2 to the match of Current Trip +1 within INDEX:
={A2:INDEX(A2:A,XMATCH("CURRENT TRIP",B2:B)+1)}
Related
Much like the problem with the transposing of data in transpose column data I am stuck trying to transpose a set of data with multiple variables. The biggest issue I face is trying to remove useless data. Table 1 is how the data is received
Column N
Sep 07 2022
Alert
Something went wrong
fish company
70000123456
1234567
231.03
View Details
Sep 07 2022
---
meat company
70000987654
688773
View Details
Sep 07 2022
Success
produce company
70000192837
View Details
Table 2 is the desired output
Column A
Column B
Column C
Column D
Column E
date
vendor
po
Invoice
cost
Sep 07 2022
fish company
70000123456
1234567
231.03
Sep 08 2022
meat company
70000987654
D688773B
Sep 07 2022
produce company
70000192837
I was unable to trim cells Alert and Something went wrong due to nesting errors.
REDUCE the array to the string, joined by delimiters. If the value is a date, join by 🍚, else if it's a value of interest determined by REGEXMATCH, join by 🐇. From the created string, split by the row delimiter 🍚, TRANSPOSE and SPLIT by the column delimiter 🐇
=ARRAYFORMULA(SPLIT(TRANSPOSE(SPLIT(REDUCE(,A2:A20,LAMBDA(a,c,IFS(ISDATE(c),a&"🍚"&TO_TEXT(c),REGEXMATCH(TO_TEXT(c),".*company|70{5}\d+|\d+"),a&"🐇"&c,TRUE,a))),"🍚")),"🐇"))
Sep 07 2022
fish company
70000123456
1234567
231.03
Sep 07 2022
meat company
70000987654
688773
Sep 07 2022
produce company
70000192837
If you don't care about dragging formulas, you might be able to use something like the following steps I did:
Pasted your data starting in cell A2.
Put a formula for to identify dates to the right of your data starting in cell B2: =N(B1)+if(ISDATE(A2),1,0) (NOTE this formula isn't dynamic)
Create a unique list filter list cell D1: =UNIQUE(Filter(B:B,B:B<>""))
Used formula to parse out data next to unique list (so starting in E2): =Transpose(FILTER(if(A:A="Alert",,A:A),(B:B=D2)*(A:A<>"ALert")*(A:A<>"Something Went Wrong")*(A:A<>"View Details")))
As you can see in part 4, I tried to strip out members that you flagged as irrelevant. I'm not sure what other rules you have.
There's probably a way to make steps 2 and 4 dynamic spill formulas, but that's all I have time for.
Ended up with this (yellow cells have relevant formula).
I have a spreadsheet where I'm tracking my net worth over time. Once a month, I add in my account balances.
In one sheet, I have this structure:
Date
Year
Net Worth
Account1
Account2
Account3
Jan 31, 2021
2021
$320
$200
$140
-$20
Feb 28, 2021
2021
$340
$200
$150
-$10
Mar 31, 2021
2021
$410
$250
$200
-$40
Apr 30, 2021
May 31, 2021
...rest of months for the year
The formula in the Year column is =if(C3<>"", year(A3), "").
The formula in the Net worth column is =if(sum(D3:F3)<>0, sum(D3:F3), "").
The Problem:
I'd like to have a cell which lists the greatest 1 month change (so $410 - $340 = $70), without having to update the formula every month. (In an ideal world, I never need to touch it again, only ever having to enter account balances once a month.)
What I've got so far:
=if(
abs(min(ArrayFormula(C3:C400 - C2:C399)))=max(ArrayFormula(abs(C3:C400 - C2:C399))),
min(ArrayFormula(C3:C400 - C2:C399)),
max(ArrayFormula(C3:C400 - C2:C399))
)
However, this includes the change from $410 to "", which is coerced to $0. So instead of the expected $70, I'm instead getting $410.
How can I get the greatest 1 month change, but ignore the empty string values?
Easiest way to fix it is just to put in an if clause I think:
=ArrayFormula(max(if(C3:C400<>"",abs(C3:C400-C2:C399),)))
because Max will ignore the empty string generated by the If statement
or slightly shorter:
=ArrayFormula(max((C3:C400<>"")*abs(C3:C400-C2:C399)))
so that the change for any empty cells is set to zero.
These assume that C2 itself is not blank!
I have a Google Sheet with data like this:
Date
In
Out
July 13
£40
July 21
£60
etc.
I'd like to add another column "month" which specifies what month the entry was made in. Only problem is I can't use the standard MONTH() function because for accounting purposes, the tax month is 16th - 15th. So July 13 would be considered to be in the June/July tax month, while July 21 would be considered to be in the July/August tax month.
I'm assuming I will need to maintain a table of the specific cut off dates like so:
Month
Start
End
Jun/July
16th June
15th July
etc.
But I can't work out how to use this as a lookup table to achieve what I want. Any thoughts appreciated.
I think this should work if your date is in A1:
=IF(DAY(A1)>15,TEXT(A1,"MMMM")&"/"&TEXT(A1+20,"MMMM"),TEXT(A1-20,"MMMM")&"/"&TEXT(A1,"MMMM"))
If sort order is important (e.g. in a subsequent pivot table) I would use this:
=IF(DAY(A1)>15,TEXT(A1,"MM MMMM")&"/"&TEXT(A1+20,"MMMM"),TEXT(A1-20,"MM MMMM")&"/"&TEXT(A1,"MMMM"))
Another way to specify the sort order is maintaining a separate table with sort order column. It's a completely different approach.
use:
=ARRAYFORMULA(IF(A2:A="",,IF(DAY(A2:A)<16,
TEXT("1/"&MONTH(A2:A)-1, "mmmm")&"/"&TEXT("1/"&MONTH(A2:A), "mmmm"),
TEXT("1/"&MONTH(A2:A), "mmmm")&"/"&TEXT("1/"&MONTH(A2:A)+1, "mmmm"))))
I am trying to build a timetable setup to work in conjunction with one of my Models. Before I state my question, I will give some context into the problem.
I have a Model called Appointments with the following columns:
Name(String)
Start_time(time)
End_time(time)
Appt_Date(date)
Now I can have multiple appointments in 1 day.
For Example, let's say I have the following 2 Appointment objects:
Appointment 1:
Name: Makeup Appointment
Start_time: 11:00 am
End_time: 1:00 pm
Date: March 30, 2016
Appointment 2:
Name: Daily Meetup
Start-time: 2:00 pm
End_time: 3:00 pm
Date: March 30, 2016
I would like to implement a date-picker form where you can select a date and it would render 24 rows(1 for each hour of the day) and fill in the rows with the times not available based on the appointments on that day.
For example, if I select March 30, 2016 from the date-picker, I would like to render the 24 rows and have the rows for 11am-1pm and 2:00pm-3:00pm shaded out.
The setup is like google calendars(how time slots are colored in) but with a day-to-day basis. I don't need to be able to edit these rows. I just need to view them and have them rendered with colored cells based on Appointment objects for that specific day.
My issue is, I don't know where to begin to be able to design these 24 rows that interact with appointment objects. I was thinking that perhaps I build a helper method, however even that I am pretty lost. I would appreciate some guidance on how to approach this.
Below will help you:
1.Create a file in initializer which contains list of available time slots like 10 am to 10 pm.
2.For displaying date time field , use some jquery date time picker plugin.
3.Fire an ajax when clicked on datetime picker.
4.Ajax request will come on the controller & where you have to create an active record query which will fetch all apointments according to the particular date.
5.MAke an array variable & store the time which are already booked in the above appointments.
6.Compare the available time with the booked time & edit datetimepikcer.js to shaded the booked date.
I want to calculate number of employee who has commanded to shoot on every day.
Shoot.where("command_type = ?", "shoot").group("DATE(created_at)").group("employee_number").order("DATE(created_at)").count
It will give me a output like
{[Wed, 03 Aug 2011, "7838744451"]=>2, [Wed, 03 Aug 2011, "8055898284"]=>11,[Fri, 05 Aug 2011, "9702553828"]=>1, [Fri, 05 Aug 2011, "9717466677"]=>1,[Fri, 05 Aug 2011, "8055898284"]=>1,[Wed, 06 Aug 2011, "8055898284"]=>5
I want to have an array something like:-
[2,0,3,1] // zero is for the dates when no record is there for that date. and number in the array is that number of the employees that has been ordered to shoot.
For example from array: 2 employee were ordered to shoot on Wed, 3rd.
0 employee were ordered to shoot on 4th and so on...
Also: How can i calculate that a how many times all employees were commanded to shoot in a week/month. Basically 100 employee were ordered to shoot 1st week. 120 employees were order to shoot 2nd week and so on 1st month and 2nd month..
The command you are using returns the daily count by employee. If you want to get the daily count across employees, remove the 2nd group call.
# return [2,3,1]
Shoot.where(:command_type => shoot").group("DATE(created_at)").values
If you want to fill the missing date values, you can use this function:
class Shoot
def self.daily_count_by_type(type = "shoot", range=7.days)
counts = Shoot.where(:command_type => type).group("DATE(created_at)").
count("DISTINCT employee_id")
(range.ago.to_date..Date.today).map {|d| counts[d.to_s] || 0}
end
end
Now
Shoot.daily_count_by_type # for type `shoot`, last 7 days
Shoot.daily_count_by_type("shoot") # for type `shoot`, last 7 days
Shoot.daily_count_by_type("eat", 14.days) # for type `eat`, last 14 days
Shoot.daily_count_by_type("leave") # for type `leave`, last 14 days
Make sure you add an index on DATE(CREATED_AT) to improve the performance.
Edit 1
Based on the comment you need to COUNT the distinct values. I have updated the answer accordingly.