Removing all numbers and letters after a specific character - google-sheets

I am currently working on a table where I have the sale price in the wrong format in some places please see my google sheet.
Essentially, I have something like this:
Price
22.99;&amp
19.99:sales
22.99
16.99
16.99;---11
18.99;:=---21
30.99
17.99
27.99
28.99
19.99
23.99
59.99
49.99aaa
I want to remove all the unneccessary characters after the : or ; or even letters.
I tried using this function =LEFT(E2,FIND(";",E2)-1) and whilst it initially worked for some, I ended up getting this instead:
Repaired Price
22.99
#VALUE!
#VALUE!
#VALUE!
16.99
18.99
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
Not sure where I messed up now. I am sure there maybe another easier way or a fix for this
Thanks

In cell G2 I entered this formula
=ArrayFormula(regexextract(E2:E15&"", "(\d+\.\d+)")+0)
See if that works for you?
Explanation
See here for an explanation of the regex pattern.
References
Regexextract
Arrayformula

Related

Formula to Find Count of Even Numbers in Google Sheets

I have found this question/answer useful:
Formula to Find Count of Odd Numbers in Google Sheets
but whilst it works for my array with odd numbers, I also want to count the even numbers and the equivalent with ISEVEN counts blank cells as even numbers giving an incorrect result there. How can I use the ISEVEN function whilst also telling the formula to ignore the blanks? I have tried the "<>" and ISNUMBER in almost every permutation and played around with COUNTIFS, but so far not got anything to work. Please help!
Try these formulas, Take a look at Example Sheet
ODD
=ARRAYFORMULA(COUNTIF(ISODD(FILTER(FLATTEN($A$1:$O$20),FLATTEN($A$1:$O$20)<>"")), TRUE))
EVEN
=ARRAYFORMULA(COUNTIF(ISEVEN(FILTER(FLATTEN($A$1:$O$20),FLATTEN($A$1:$O$20)<>"")), TRUE))
COUNTA
=COUNTA(A1:O20)
Total check "EVEN output + ODD output"
=B22+B23
Blanks
=(ROWS(A1:O20)*COLUMNS(A1:O20))-COUNTA($A$1:$O$20)

Filter in Google sheets gives me blank if I select the whole column

I have this formula that works pretty well.
=filter(RawData!A:A,RawData!F:F=D2)
If I drag the formula, it shows #N/A until the criteria returns a date. Example:
#N/A
#N/A
#N/A
2020-08-01
#N/A
#N/A
But I don't want to drag the cells, I want it to fill automatically, so I edited the last criteria like this:
=filter(RawData!A:A,RawData!F:F=D:D)
Without specifying the exact D column, it just gives me blank cells.
The strange thing is that I have a similar formula elsewhere and its working. Just different sheets but with the same kind of data.
Anyone knows what might be causing this?
https://docs.google.com/spreadsheets/d/1oj7LSbsRF_7HDEgcXsJw4xpOFKHhLBm6is9EVfqTqzw/edit?usp=sharing
When you use:
=filter(RawData!A:A,RawData!F:F=D2)
You are looking for any cell in RawData!F:F that matches D2; it's not required that this cell is on the same row. If, for example, RawData!F15 matches D2, RawData!A15 will be returned.
That is a far less restrictive filter than the one corresponding to:
=filter(RawData!A:A,RawData!F:F=D:D)
In this last case, the match should be found in a specific row. For example, RawData!F15 matching D2 will not cause RawData!A15 to be returned. Instead, F2 will be compared to D2, F3 to D3, and so on. And with your current data, there is no match to be found.
That's the reason the same formula "works" on B and not on C (there are matches to be found for =filter('Lead + source'!H:H,'Lead + source'!A:A=D:D), but not for =filter(RawData!A:A,RawData!F:F=D:D)).

Google spreadsheet -- how do I sum up my wages in this spreadsheet?

I am trying to calculate my earnings on a Google Spreadsheet but have no idea what I am doing. I got this far with spreadsheets, but VLOOKUP returns a #N/A error and I can't calculate the sum in column B5. What am I doing wrong? Here's my spreadsheet:
https://docs.google.com/spreadsheets/d/1bsbQ4_0cITvdTqWWdX-Et1fiTL9Qw3WD_aminlpqgwY/edit?usp=sharing
The error message #N/A is caused by the VLOOKUP operation in cell D9. It is looking up cell C9, which is blank. There must be a value in a VLOOKUP operation. If you want to make this message go away, either put a value into C9 or use the IFERROR function. This only gives a value if the output is not an error. In cell D9, you can put this formula:
=IFERROR(VLOOKUP(C9,$C$2:$D$5,2,FALSE)). This should return nothing if there is an error.

ARRAYFORMULA VLOOKUP with ISBLANK in google sheets

I am trying to get a VLOOKUP to work on an entire column (minus the header), but I want blank entries if the column I am searching for is empty. I tried both these formulas, but to no avail (I still get the N/A in empty cells):
=ARRAYFORMULA(IF(ISBLANK(VLOOKUP(O2:O,Sheet1!B:C,2,FALSE)),"",VLOOKUP(O2:O,Sheet1!B:C,2,FALSE)))
=ARRAYFORMULA(IF(O2:O<>"",VLOOKUP(O2:O,Sheet1!B:C,2,FALSE)),"")
This is a slightly more complicated way than what I got working in another part of my sheet, which is the same without the VLOOKUP:
=ARRAYFORMULA(IF(ISBLANK(J2:J),"",J2:J))
Any ideas what am I doing wrong?
If you want to leave a blank instead of #N/A in a cell, you can use =IFERROR.
Like this:
=IFERROR(Your_formula, "value if the formula returns an error")
Since you are using ARRAYFORMULA, the iferror must be inside it
=ARRAYFORMULA(IFERROR(VLOOKUP(O2:O,Sheet1!B:C,2,FALSE),""))

Make countif ignore "- -" from continue

I'm having trouble with a countif that I am using to count the number of entries in a range. The problem is that the range is populated with an array formula, and when the data changes the cells the array formula added a =CONTINUE(...) to now display -- (minus minus)
=COUNTIF(C6:C, "<>")
Is there a way that the countif could be written to ignore cells with --?
The -- is a way that Google Sheets displays the #VALUE! error. So you can use the IFERROR function to "mask" any of these errors:
=ArrayFormula(COUNTIF(IFERROR(C6:C);"<>"))
or more simply:
=ArrayFormula(COUNTA(IFERROR(C6:C)))
Updated:
Why don't you filter out all cells that are not text or similar to --?
Then use filtered range for countif.
=COUNTIF((ROWS(C6:C)-COUNTIF(C6:C"<>*")) , "ur criteria")
Is there a way your formula array could cast a string other than --?
Check this article
The search you are doing has regular expression.
Writing this on mobile. So please try out and pardon for weird formatting.

Resources