Removing letter from cell - excel-2010

I have lists of dates that look like this 07-Aug-17 A. Some dates have the A at the end, some do not. I want to remove the A at the end of the cell. Everything I try either removes the A at the end as well as the A in Apr, or Aug. Or it removes the A at the end, and if there isn't an A at the end, then it removes part of the date itself.

if you have dates in fixed format like 14-Apr-17
14-Aug-17 A
14-Aug-17
14-Sep-17
you can use left function as the length of each date will be of 9 characters in this case.
use : =VALUE(LEFT(A1,9)). Do not forget to change the format of result cell to dates.

Related

Google Sheets – Query for a date returns no values

​​I'm trying to filter a list from another sheet by the dates of the entries and simply doesn't work:
=QUERY(Import!A:Z;"select A,T where T >= date '2021-08-27'";0)
​When I remove the date part it works fine, as expexted for filtering by text. I need the ability to sort by exact dates though, because I would like to add some more complex filters. When I set the last part of the function to a 0 instead of a 1 it shows only the first entry.
The source column is set to the correct date format. The data is pulled from another document using the IMPORTRANGE()​ function (I don't seee how this should make any difference though).
I feel like I'm misssing something simple here and would be glad if someone can point me in the right direction!
Check your date column if all cells are formatted as date. I had missing values as "='---" and the query filtering by date returned nothing. Changing the missing values to "=NA()" did the job.
Try this:
=QUERY(Import!A:Z;"select A,T where T >= date '"&TEXT("2021-08-27";"yyyy-mm-dd")&"'")

How do I conditionally format a date that falls between two dates from a list of start and end dates?

I have created a dynamic calendar in a Google Sheets document and with it a list of dates:
The days are dynamically populated with the full date but formatted to only show the day (for example, the full value of August 22nd is 8/22/2020 but it is formatted to only show 22). I would like to use conditional formatting to highlight the date ranges listed on the right. For instance, I would simply like the dates 8/12, 8/13, and 8/14 (in addition to the other date ranges in those columns) to be highlighted using conditional formatting.
I've been able to get single ranges highlighted by directly targeting the I and J cells in the range A3:G8 like so:
=AND(A3>=$I$2,A3<=$J$2) or by switching up the column value. Removing any $ symbol breaks the conditional formatting.
I know this is not correct to get each range in the list to appear, but this is the only way I could get any ranges to work. Obviously I don't want to go one by one, but nothing else I've tried has worked. I've spent the last 5 hours scouring the internet and have come up with nothing like this problem. I have tried too many things to list here, and nothing has worked.
FWIW, this is my test data set. My full data set is much larger, is not sorted by start date, and has some start dates missing. I could potentially clean up the missing start dates if necessary, but my final dataset can't be sorted.
Ideally, the final product should look something like this:
Try
=SUMPRODUCT((A1<=$J$2:$J)*(A1>=$I$2:$I)*(A1<>""))>0
You can add as many rows as you wish.
Explanation
In this formula, you have 3 conditions
=SUMPRODUCT(condition1 * condition2 * condition3)
If one condition is false, you will get 0 (for instance truefalsetrue = 0 )
If all three conditions are true, you will get something > 0, that means that the date is not null and between a range of dates

How do I filter a list with date and time values by only extracting specific times each day?

I have a list of days and times in column A. Column B is a dollar value for each time value.
I want to get a specific time for each day and list the price in the next column. I have this right now:
The formula for column J is this:
=filter(A11:B,(mod(A11:A,1)*24)>=4.5,(mod(A11:A,1)*24)<=4.6)
This formula filters 4:30AM and the price associated with it.
Formula for column L is this:
=filter(A11:B,(mod(A11:A,1)*24)>=9.5,(mod(A11:A,1)*24)<=9.6)
Which filters only 9:30AM for each day and the price that goes with it.
As you can see, the dates stop matching when column J is 8/12/2021 and column L is 8/13/2021. This is because column L didn't have 9:30AM for 8/12/2021 so it skipped to 8/13/2021.
How can I make so that one of the columns skip a date if the other column doesn't match that time? I don't know if I explained that well but in the example above, column J should skip 8/12/2021 because column L didn't have 8/12/2021.
Another way of dealing with this issue is perhaps using UNIQUE and FILTER formulas but I'm not sure how that could be done. Any help would be greatly appreciated!
Here's a link to the spreadsheet: https://docs.google.com/spreadsheets/d/1TvP0_UsYJbLb5bscx2e4nTEnSkP5roBZpP8aIGdl414/edit?usp=sharing
I'm not 100% sure, but if you need to filter values so the time element is 09:30 and 04:30, then hide values where a date only occurs once (ie. no 09:30 value or no 04:30 value), you could use:
=arrayformula(filter(
filter(A11:B,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5)),
countif(int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))),int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))))>1)
)
Adjust >1 at the end to whatever logic you need (=2, <>1 etc).
You can also add sort() around everything if you need to.
Explanation:
It turns out that mod(A11,1)*24 doesn't round particularly well, so I suggest round(mod(A11:A,1)*24,2).
Therefore to filter the date/times for 9.30am and 4.30am, you can apply:
round(mod(A11:A,1)*24,2)=9.5
and
round(mod(A11:A,1)*24,2)=4.5
like this:
=arrayformula({filter(A11:B,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))})
filter is usually AND but to get OR condition it's filter(A:B,(A=1)+(A=2))
This gets the dates only:
=arrayformula(int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))))
Then this counts how many times a date appears:
=arrayformula(countif(int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5))),int(filter(A11:A,(round(mod(A11:A,1)*24,2)=9.5)+(round(mod(A11:A,1)*24,2)=4.5)))))
Combining the elements gets the solution.
I'll add a tab to your sheet.
You could filter each list on finding a match for each date (integer part of datetime) in the other list:
In J:
=filter(A11:B,(mod(A11:A,1)*24)>=4.5,(mod(A11:A,1)*24)<=4.6,isnumber(match(int(A11:A),int(filter(A11:A,(mod(A11:A,1)*24)>=9.5,(mod(A11:A,1)*24)<=9.6)),0)))
In L:
=filter(A11:B,(mod(A11:A,1)*24)>=9.5,(mod(A11:A,1)*24)<=9.6,isnumber(match(int(A11:A),int(filter(A11:A,(mod(A11:A,1)*24)>=4.5,(mod(A11:A,1)*24)<=4.6)),0)))
Note
Plz see Aresvik's answer for a possibly better approach to rounding, but note that 4:30 (3/16) actually has an exact representation as a binary decimal so rounding errors aren't an issue here.

Combine 2 REGEXREPLACE Formulas Into One

In cell C5, I have a date with dashes ---> 01-31-2013
I just need to remove the dashes, extract only the first 4 digits in the date (in this case, 0131), and append 'Efisd' at the BEGINNING of the string.
So, the end result should look like this ---> Efisd0131
So far, I've been able to remove the dashes, and extract the first 4 digits of the date. But, I can't seem to put append 'Efisd' to the beginning and put it all together into one formula.
Does anyone know how to do this? Thanks for your help.
Here's the sample spreadsheet that you can edit
From just the input date you can get it done with this:
="Efisd"&left(substitute(B5,"-",""),4)
It substitutes the dashes for blanks, gets the left 4 characters, and ads Efisd to the front.
If anyone wants the arrayformula version of this, here it is below. Put formula in very top cell in column, edit the header in between quotes, and change cell values to fit your spreadsheet.
={"Your Header";arrayformula(iferror(if(len(M2:M),"Efisd"&left(substitute(M2:M,"-",""),4),""),))}

Google new spreadsheet Split() function bug?

try this.
in cell A1 10/8/2013 Mike1, 2013, 0
now Split(A1,",")
now change A1 and add a colon 10/8/2013 Mike:1, 2013, 0
Split(A1,",") ... notice how Mike:1 is gone. Bug?
I need to split something with a colon in it and it is chopping off part of the text
The problem is that "10/8/2013 Mike:1" is interpreted as a date, it seems to be something like: "dd/mm/yyyy hhhh:mm". (if you change the display of the first cell to raw text you'll see he is giving you a number: 41496).
try this formula:
=arrayformula(SUBSTITUTE(arrayformula(split(REGEXREPLACE(A1;":";"###");","));"###";":"))
in a easier way: As I suppose you can't change the way it's displayed, the possible workaround that I see here is to first split around the ":", then split with the "," and then join the two first elements.
I can't reproduce this issue, either with function SPLIT or with Split text into columns... and with or without formatting as dd/mm/yyyy hhhh:mm.
Select A1, Data > Split text into columns... is all that is required.

Resources