I just want to count the dates Monday of each number in column C filtered by column A. But it is giving an error in the formula:
=NETWORKDAYS.INTL (JANEIRO!C2, "1"; FEVEREIRO!C2, "1 ")
drive link here
paste in A2 cell and drag down:
=ARRAYFORMULA(SUM(N(REGEXMATCH(""&TRIM(SPLIT(QUERY({JANEIRO!A$2:C; FEVEREIRO!A$2:C};
"select Col1 where dayOfWeek(Col3) = 2"; 0); ",")); "^"&TO_TEXT(A2)&"$"))))
spreadsheet demo
there are no mondays. formula is:
=COUNTA(IFERROR(QUERY({JANEIRO!C2:C; FEVEREIRO!C2:C};
"where dayOfWeek(Col1) = 2"; 0)))
Related
=ARRAYFORMULA(IFERROR(
substitute(IMPORTHTML("https://niftyinvest.com/option-chain/"&D2&"?expiry="&$B$2,"Table",1),"*","")*1,
substitute(IMPORTHTML("https://niftyinvest.com/option-chain/"&D2&"?expiry="&$B$2,"Table",1),"*","")))
where D2 = MARUTI and B2 = 30Jun2022 let's say...
Now I want to remove the row in which all columns value is zero.
Try
=query(ARRAYFORMULA(IFERROR(substitute(IMPORTHTML("https://niftyinvest.com/option-chain/"&D2&"?expiry="&$B$2,"Table",1),"*",""), substitute(IMPORTHTML("https://niftyinvest.com/option-chain/"&D2&"?expiry="&$B$2,"Table",1),"",""))),
"where "&ARRAYFORMULA(TEXTJOIN(" and ",, "Col"&SEQUENCE(11,1,1,1)&" is not null")),1)
use:
=QUERY(ARRAYFORMULA(IFERROR(
SUBSTITUTE(IMPORTHTML("https://niftyinvest.com/option-chain/"&D2&"?expiry="&$B$2,"table",1),"*",)*1,
SUBSTITUTE(IMPORTHTML("https://niftyinvest.com/option-chain/"&D2&"?expiry="&$B$2,"table",1),"*",))),
"where "&TEXTJOIN(" and ", 1, "Col"&SEQUENCE(11)&" <>0"))
I have a sheet with 4 tabs with several data, where the date and time of the registration of the reports is in the column A. I created a new tab which will gather all the other sheets data. So I am using QUERY:
=QUERY({
Sheet2!A1:D;
Sheet3!A1:D;
Sheet4!A1:D;
Sheet5!A1:D
},
"select * where Col2 is not null order by Col1",0)
However, I need to place in Sheet1 all the data sorted by the last 10 days:
https://docs.google.com/spreadsheets/d/1mzFEEZwDma0MAUUBnlmXvwWjCBpeDiaBDDXB584fu7A/edit#gid=0
Note: Query is already sorting by dates
try ascending:
=SORT(QUERY(SORT({
Sheet2!A1:D;
Sheet3!A1:D;
Sheet4!A1:D;
Sheet5!A1:D}, 1, 0),
"where Col2 is not null limit 10", 0))
or descending:
=QUERY(SORT({
Sheet2!A1:D;
Sheet3!A1:D;
Sheet4!A1:D;
Sheet5!A1:D}, 1, 0),
"where Col2 is not null limit 10", 0)
Oracle Select query is not returning any results when using trim on char(2) column. The database field has only spaces. However, when the field has a space and a character, I get the correct results.
e.g.
Action_code char(2)
val = " 8"
Select * from abc where trim(Action_code) = trim(val)
Here I get the rows having " 8".
But,
val = " "
Select * from abc where trim(Action_code) = trim(val)
Here I don't get any rows from database where Action_code is " ". But I have such rows in database.
Can someone please help me how to get rows in 2nd case?
I just found that when you trim a variable or database column which has only spaces, it is treated as null by Oracle. So the following query works:
val = " "
Select * from abc where trim(Action_code) is null and trim(val) is null
Now I get the rows from database where Action_code is " ".
Why you don't try to use the nvl function ?
nvl(valueIsNull,returnOtherValue)
?
I cannot select these powerpivot slicers with variables. They are dates (Monday-Saturday or 1/19-1/25). For some reason I cannot figure out how to select the slicers without the static dates and instead my date strings from a Monday string and Saturday string? I tried concatenating them in but no success.
Sheets("Phone Report").Select
ActiveWorkbook.SlicerCaches("Slicer_Weeks_Ago").VisibleSlicerItemsList = Array _
( _
"[Phone Cube Query].[Weeks Ago].&[01/12 - 01/17]") 'So want to replace the 01/12 and the 01/17 with my string variables?
ActiveWorkbook.SlicerCaches("Slicer_Day_and_Rank").VisibleSlicerItemsList = _
Array( _
"[Phone Cube Query].[Day and Rank].&[1. Monday]", _
"[Phone Cube Query].[Day and Rank].&[2. Tuesday]")
Variables:
Today = Weekday(Date, vbMonday)
If Today = 2 Then
Todayy = Date
Monday = Date - 1
ElseIf Today = 3 Then
Todayy = Date
Monday = Date - 2
ElseIf Today = 4 Then
Todayy = Date
Monday = Date - 3
ElseIf Today = 5 Then
Todayy = Date
Monday = Date - 4
ElseIf Today = 1 Then
Todayy = Date - 2
Monday = Date - 7
End If
Todayy=left(Todayy, 5)
Monday=left(Monday, 5)
Thanks for any possible help or suggestions.
I'm sure you found an answer by now. I had this issue for weeks and I tried to make complicated loops, but I found an easier way.
Yes, the macro recording shows an array of the slicer information. I found out if you delete the array() portion of the code you can do exactly what you need.
Here's my quick example. Operation is the variable:
ActiveWorkbook.SlicerCaches("Slicer_Oper").VisibleSlicerItemsList = Array( _"[Actuals_Table].[Oper].& [" & Operation & "]")
Changed to
ActiveWorkbook.SlicerCaches("Slicer_Oper").VisibleSlicerItemsList = "[Actuals_Table].[Oper].&[" & Operation & "]"
I have the NFL season schedule saved in an SQL Server DB. A Game table has fields of Week (referring to the week of the season in which the game takes place [1-17]), AwayTeamID, and HomeTeamID, among others. The AwayTeamID and HomeTeamID fields are foreign keys referencing the Team table. I want to use a LINQ statement (within an ASP.NET MVC 3 app) to return games by week, including team names from the Team table. I know at least one way to do this, but specifically (and I'm hoping more elegantly), I'd like return a result that has each week associated with a sequence of games that correspond to that week, instead of a returning a sequence of new { Game, AwayTeam, HomeTeam } objects and then drilling into the Game item to get the week. I'm not sure I've made my goal clear...if not, let me know and I'll try to clarify.
I read on 101 LINQ Samples about something similar using the into keyword within a join statement so that the result would be a sequence of weeks, each associated with its own sequence of games. Using the example from that site, I tried the following:
string[] wks = { "1", "2", "3" };
var model =
from g in _db.NFLGames
join a in _db.NFLTeams on g.AwayTeamID equals a.NFLTeamID
join h in _db.NFLTeams on g.HomeTeamID equals h.NFLTeamID
select new TestGameModel { Game = g, AwayTeam = a.Name, HomeTeam = h.Name };
var weekgames =
from w in wks
join gm in model on w equals gm.Game.NFLWeek into gw
select new TestNflWeeklySchedule { Week = w, Games = gw };
foreach (var wg in weekgames) {
System.Diagnostics.Debug.WriteLine("NFL week: " + wg.Week + " number of games this week: " + wg.Games.Count());
foreach (var g in wg.Games) {
System.Diagnostics.Debug.WriteLine(" " + g.AwayTeam + " at " + g.HomeTeam + " [" + g.Game.DateTimeStart + "]");
}
}
The code executes, but the output is
NFL week: 1 number of games this week: 0
NFL week: 2 number of games this week: 0
NFL week: 3 number of games this week: 0
Apparently, the second query joining the model is not matching the games that occur in the designated week. I've also tried, instead of two queries, just one LINQ statement, which essentially nests the first query within the second. That gave me the same result.
Can anyone tell me what error I have in my code or why this is not working? I'm new to LINQ, so there's a good chance it's something simple.
Is this what you're looking for?
var weekGames = _db.NFLGames.GroupBy(g => g.NFLWeek);
foreach (var wg in weekGames)
{
Debug.WriteLine("Week: " + wg.Key + " Games: " + wg.Count());
foreach (var g in wg)
{
Debug.WriteLine(g.AwayTeam + " at " + g.HomeTeam + " [" + g.Game.DateTimeStart + "]");
}
}