I have here formula that can easily convert the weekday text like Sunday to weekday int to 1.
=MATCH(A2,{"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"},0)
My question is how to convert array-text to array-int?
Let's say for example in a cell, I have value Sunday, Monday. Do we have a formula for us to get the array for example {1,2}?
About Let's say for example in a cell, I have value Sunday, Monday. Do we have a formula for us to get the array for example {1,2}?, I guessed that from your showing formula is used, you might have wanted 7 and 1. If my understanding is correct, when your sample formula is used, how about the following modification?
Modified formula:
=ARRAYFORMULA(MATCH(TRIM(SPLIT(A1,",")),{"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"},0))
In this case, Sunday, Monday is put in cell "A1".
Testing:
Note:
When the following formula is used,
="{"&TEXTJOIN(",",TRUE,ARRAYFORMULA(MATCH(TRIM(SPLIT(A1,",")),{"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"},0)))&"}"
When Sunday, Monday is put in the cell "A2", {7,1} is put to a cell.
you can also try:
="{"&JOIN(",",INDEX(MATCH(SPLIT(A2,", "),TEXT(SEQUENCE(7,1,2),"DDDD"),0)))&"}"
Related
I have a list of dates in Column 1, which I have formatted as custom date. 1/1/2023 for example shows as Sunday 1
I need to have other cells in the table show "Weekend" if the cell in column 1 contains Saturday or Sunday
The following formula works for one of them:
=IFERROR(IFS(SEARCH("Saturday", A2), "WEEKEND"), "")
But I need it to search for both Saturday and Sunday. I've tried the following but it's not working:
=IFERROR(IFS(SEARCH("Saturday", A2), "WEEKEND"), "None",(SEARCH("Sunday", A2), "WEEKEND"), "None")
try:
=INDEX(IF(LEN(A:A),IF((WEEKDAY(A:A)=1)+(WEEKDAY(A:A)=7),"WEEKEND",),))
If you actually have text, you can use wildcards:
=IFERROR(IF(SEARCH("S*DAY",A2),"WEEKEND",),)
Also applicable for INDEX or ARRAYFORMULA
=INDEX(IFERROR(IF(SEARCH("S*DAY",A2:A),"WEEKEND",),))
I would highlight, in Google Sheet, the columns of months based on dates in col AA:
dd/mm/yyyy (start date) - dd/mm/yyyy (end date).
Example:
Col AA ---> 25/05/2022 - 06/09/2022
The columns that must be highlighted: from May to September.
The best way is to change headers of column and put inside the first day of each month. Then apply a format as MMMM.
Conditionnal formatting formula:
=and(C$1>=EOMONTH($A2;-1)+1;C$1<=EOMONTH($B2;0))
if you can't change headers, the formula will be:
=and(MATCH(proper(text(index(split($AA2;" - ");1);"MMMM"));{"Gennaio";"Febbraio";"Marzo";"Aprile";"Maggio";"Giugno";"Luglio";"Agosto";"Settembre";"Ottobre";"Novembre";"Dicembre"};0)<=MATCH(B$1;{"Gennaio";"Febbraio";"Marzo";"Aprile";"Maggio";"Giugno";"Luglio";"Agosto";"Settembre";"Ottobre";"Novembre";"Dicembre"};0);MATCH(proper(text(iferror(index(split($AA2;" - ");2);"31/12/2022"*1);"MMMM"));{"Gennaio";"Febbraio";"Marzo";"Aprile";"Maggio";"Giugno";"Luglio";"Agosto";"Settembre";"Ottobre";"Novembre";"Dicembre"};0)>=MATCH(B$1;{"Gennaio";"Febbraio";"Marzo";"Aprile";"Maggio";"Giugno";"Luglio";"Agosto";"Settembre";"Ottobre";"Novembre";"Dicembre"};0))
You can try a much simpler formula:
=(EOMONTH(DATEVALUE("1/"&C$1);0)>$A2)*(DATEVALUE("1/"&C$1)<=$B2)
this works for current year.
If you want to use another year add it to string in DATEVALUE function, i.e. =DATEVALUE("1/"&C$1&"/2020")
A header
B header
C header
First
01.01.2000
something
Second
02.01.2000
something
I have a sheet with B column filled with dates.
I have 4 conditional formattings: today, tomorrow and "overmorrow" dates.
The fourth condition is the following:
Mark the cell IF its date is today()+3 AND its weekday is Monday.
The simple options "date is exactly" works for "today()+2". But it declines to works with =and() formula. It should get the date type, not a boolean.
As for the formula option, I cannot invent the right formula. This doesn't work:
=and(today()+2,weekday()=2) - I believe that, when you select a non-simple option (not like date -> is exactly) it should take the real arguments, and should not contain empty function calls like weekday().
enter image description here
You should use this custom formula: =AND(B1=today()+2,weekday(B1)=2)
Sample:
Custom formula: =AND(B1=today()+3,weekday(B1)=2)
Note: I used today()+3 temporarily just to show that the conditional formatting is working since my current day is friday.
So I am trying to recreate something like this picture:
Financial Year in excel
But I just found out that the cell B7 does not work, the cell B7 contains the formula:
=IF($A$3="Financial Year",((CONCATENATE(B9,$C$3))-DAY(CONCATENATE(B9,$C$3))+1),EDATE(Summary!$C$15,-11))
In the above A3 cell is the one where I choose Financial Year, B9 is month January, C3 is the cell with the calendar year 2020 and the Summary tab is the picture here:Summary Tab where cell C15 is the starting date with the formula: =EOMONTH(TODAY(),-1)+1
Error I am getting from Cell B7:
Function Day Parameter 1 expects number values. But "January" is a text and cannot be coerced to a number
You may have had a temporary condition where C3 was blank. It is easy to run several tests to see what Day does with "Strings".
=Day("January" & 2020) returns 1, the day value of the first day of January.
=Day("January2020") also returns 1, even though "January2020" is clearly a string.
=Day("Nothing2020") returns the error you saw, where DAY expects a numeric value.
If the string is one that Google Sheets recognises as a date type, it treats it as a number value for those functions requiring that.
"January2020" is seen as a valid date, but "January" is not.
Your error indicates to me that C3 was blank at the time of the error, since it said {
"January" is a text, and cannot.....} .
Let us know if you still have the error situation. If so, please share a copy of your sheet.
I have a Spreadsheet with duration values in one column, and date values in another.
I want to sum duration values based on a particular day of the week... eg, in the example screenshot, the first and last dates are Friday. So I want a formula that would add the duration values from the corresponding cells... a total of 17:00
I've tried a formula like this. But this doesn't work.
=SUMIF(D:D, CHOOSE(WEEKDAY(DATE(),2), "Fri") , A:A)
You could try:
=sumproduct(weekday(A:A)=6,D:D)
try:
=TEXT(ARRAYFORMULA(SUMIF(WEEKDAY(A:A, 11), 5, D:D)), "[h]:mm")
Not sure if there is an easy way because I'm noob at Google Sheets, but try with array formula:
=ArrayFormula(SUMIF(D1:D3;WEEKDAY(A1:A3;2);5))
Using it as array formula, I got this:
Hope this helps
One approach to do this is the following:
In column E put the weekday values. Use WEEKDAY() function which depending on your setting will make Friday any integer between 1-7. If using default Friday will be "6".
Use the SUMIF() function. Eg.=sumif(E:E,"=6",D:D)
Make sure the cell where your SUMIF() formula resides, also has a duration number format.