looking for way show all unique code based on day index - google-sheets

I want to show how many unique characters on that day based on a day in one column, for example, on day 01 we have code DC13850-DC13873 , when I input the formula with day 01 I want all codes in that day to show, and also when I change the day all the code also change based on the selected day
:
day Code
01 DC13850
01 DC13851
01 DC13852
02 DC13853
02 DC13854
02 DC13855
03 DC13856
03 DC13857
03 DC13858
I've been struggling with it, can anyone help me?

try:
=UNIQUE(FILTER(E:E; D:D="01"))

Related

Google Sheets - transpose irregular column data in groups into rows

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).

Summing Delayed Cashflows - Google Sheets

A company has a list of clients, i, all of which delay their payments by X_i. The problem is to create a spreadsheet that will show the sum of positive cashflows for a given day, where the delay of incoming cashflows can be manually adjusted.
The input is:
Date
Amount Due $
Client
Expected Delay (Days)
01
100
A
2
02
5
B
0
02
30
C
1
03
50
B
0
The output needs to be:
Date
Total Inflows $
01
0
02
5
03
180
How can I code this in Google Sheets?
Use for date:
=UNIQUE(A2:A)
and for totals:
=ArrayFormula(IF(LEN(F2:F),SUMIF(A2:A+D2:D,F2:F,B2:B),))
if in date column you have text values you need convert it to real dates and format as you want

Daylight saving issue Nov 04 - 05 in EST location

Date difference is zero today. When comparing Nov 04 and Nov 05, rare issue happening only for today.
Code I'm using
let dayDiff = Calendar.current.dateComponents([.day], from:businessDate , to: today).day!
Ipad date and time set to automatically.
Tried restarting iPad.
Tried setting date to tomorrow and I get date diff 1.
Is there any issues because of changes in day light savings yesterday?
If so, what settings I have to update in order to work it as expected?
Note: We can fix it with code changes, but like to know any iPad settings will fix this problem.
In any timezone that had a change in daylight saving time during that period (such as the in USA), the difference between 2018-11-04 00:00:00 UTC and 2018-11-05 00:00:00 UTC is only 23 hours which is less than 1 day so you get a difference of 0 days.
If you create those dates with midnight local time instead of UTC time, you will get the expected result of 1 day difference.
Or if you use a calendar set to the UTC timezone to calculate the difference, you will get 1 day difference.

Capybara: How to select drop down value from below html

Capybara: How to select drop down value from below html
Month
01
02
03
04
05
06
07
08
09
10
11
12
The from option to select takes either the id, name, placeholder, or the text of an associated label element of the select element. "data-reactid" is none of those. Given the html you have put in the comments (please edit your question and add it there) you could just do
select("01") # assumes there are no other select boxes with that option on the page
or you could do
find('select[data-reactid=".0.0.1.1.2.1.$0.0.2.0.1"]').select("01")
which is just short for
find('select[data-reactid=".0.0.1.1.2.1.$0.0.2.0.1"]').find(:option, "01").select_option
Note: within '#.0.0.1.1.2.1.$0.0.2.0.1' isn't going to do anything since within takes a css selector and none of your elements have the id '#.0.0.1.1.2.1.$0.0.2.0.1' ( a data-reactid is not an id ) . On top of that the selector as written is invalid and would probably need to be within '#\.0\.0\.1\.1\.2\.1\.\$0\.0\.2\.0\.1' if an element with that id existed

Ruby on rails active record multiple group record to calculate numbers

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.

Resources