Are there any Ways to replace values that contatin specific words in Power Query? - replace

I'm having difficulties with using Power Query M-function.
The problems I'm having with is to make cells blank previously contains 'US Core shipping' on column 'promotion-ids'.
For example, there are 'US Core shipping A3JU1250912' 'US Core shipping A3JT982918'...
These words are all different but they have 'US Core shipping' in common.
So I want to make these words containing US Core shipping~ to blank.
Please help me solving this problem.
Attached below are advanced editor and current m-code on my columns.

It is a bit hard to tell exactly what you want without a sample input and desired output
To erase content in specified column if it finds matching text, maybe try
#"Replace" = Table.TransformColumns(#"YourPriorStepNameHere",{{"YourOriginalColumnNameHere", each if Text.Contains(_,"US Core shipping") then null else _, type text}})

Related

Conditional Formatting Depending Upon Multiple Numbers

I have a column of values that are a number out of 10. So, it could be 2/10, 3/10, 4/10 and so on, all the way up to 10/10. To be clear, these are not dates, but simply showing how many questions the student answered correctly out of 10.
I'm trying to use conditional formatting to highlight them a certain color depending upon the score they got. For 9/10 and 10/10, I'm wanting to use a certain color, but it doesn't seem to be working with REGEXMATCH or with OR. Also wanting to highlight all scores that are 6/10 or lower. I know that I could make this work by applying conditional formatting for each and every score with text contains but the problem I'm finding is that it thinks it's a date.
Is there a way to match multiple scores out of 10 using REGEXMATCH?
Link to Sheet
select column and change formatting to Plain text
now you can use formula like:
=REGEXMATCH(A1; "^9|10\/")

Partial results on Weka attribute selection

When I run PCA in WEKA GUI using "Select Attribute", I dont get a complete results instead a partial results with dots at the end.
0.8205 1 -0.493Capacity at 10th Cycle-0.483Capacity at 5th Cycle-0.473Capacity at 50th Cycle-0.261S [M]in Electrolyte -0.256C wt %...
Is there any way to solve this particular issue ?
By default, a maximum of 5 attribute names are included in the generated names.
If you want all of them, use -1 for the -A option (or maximumAttributeNames property in the GOE).

How can I resolve INDEX MATCH errors caused by discrepancies in the spelling of names across multiple data sources?

I've set up a Google Sheets workbook that synthesizes data from a few different sources via manual input, IMPORTHTML and IMPORTRANGE. Once the data is populated, I'm using INDEX MATCH to filter and compare the information and to RANK each data set.
Since I have multiple data inputs, I'm running into a persistent issue of names not being written exactly the same between sources, even though they're the same person. First names are the primary culprit (i.e. Mary Lou vs Marylou vs Mary-Lou vs Mary Louise) but some last names with special symbols (umlauts, accents, tildes) are also causing errors. When Sheets can't recognize a match, the INDEX MATCH and RANK functions both break down.
I'm wondering how to better unify the data automatically so my Sheet understands that each occurrence is actually the same person (or "value").
Since you can't edit the results of an IMPORTHTML directly, I've set up "helper columns" and used functions like TRIM and SPLIT to try and fix instances as I go, but it seems like there must be a simpler path.
It feels like IFS could work but I can't figure how to integrate it. Also thinking this may require a script, which I'm just beginning to study.
Here's a simplified example of what I'm trying to achieve and the corresponding errors: Sample Spreadsheet
The first tab is attempting to pull and RANK data from tabs 2 and 3. Sample formulas from the Summary tab, row 3 (Amelia Rose):
Cell B3: =INDEX('Q1 Sales'!B:B, MATCH(A3,'Q1 Sales'!A:A,0))
Cell C3: =RANK(B3,$B$2:B,1)
Cell D3: =INDEX('Q2 Sales'!B:B, MATCH(A3,'Q2 Sales'!A:A,0))
Cell E3: =RANK(D3,$D$2:D,1)
I'd be grateful for any insight on how to best index 'Q2Sales'!B3 as the correct value for 'Summary'!D3. Thanks in advance - the thoughtful answers on Stack Overflow have gotten me this far!
to counter every possible scenario do it like this:
=ARRAYFORMULA(IFERROR(VLOOKUP(LOWER(REGEXREPLACE(A2:A, "-|\s", )),
{REGEXEXTRACT(LOWER(REGEXREPLACE('Q2 Sales'!A2:A, "-|\s", )),
TEXTJOIN("|", 1, LOWER(REGEXREPLACE(A2:A, "-|\s", )))), 'Q2 Sales'!B2:B}, 2, 0)))

How to write IF AND regular expression match

I'm trying to write a simple formula for Google Sheets. The logic is as follows:
if(it is a specific date & it is today){fill cell color with this color}
I know this needs to be done in the conditional formatting section but I am unable to get it right.
I've tried:
if(TODAY(),RegExMatch("Tuesday May 2, 2017"))
RegExMatch("Tuesday May 2, 2017") AND IF(TODAY())
IF(TODAY() AND RegExMatch("Tuesday May 2, 2017"))
but none of those work and return errors such as 'parse & invalid' when attempting to write it in the cell box.
REGEXMATCH can be used in Conditional formatting (eg) but it seems way overkill here. Please select the relevant range (I am assuming ColumnA - populated with 'true' dates, not text) and clear any existing CF rules from it. Format, Conditional formatting..., Format cells if... Custom formula is and
=and(A1=today(),A1=42858)
with fill colour of choice and Done.
Here 42858 happens to be the index number for today, but would be replaced with that for your specific date.
Have you tried just getting the value of TODAY()? It returns the date in mm/dd/yyyy format. Your RegExMatch will always fail.
You don't need to use any formula. Use this guide to see how you can use conditional formatting rules on individual or multiple cells. The correct way to do what you want to do is to select a cell, click on Format -> Conditional formatting... -> Format cells if... -> Date is -> today
If you're referring to the cell box in the 'Custom formula' section, you simply need to write =TODAY().
Not sure I'm following exactly, but if your date is in col A:
=AND(DATEVALUE(a1)=datevalue("5/2/2017"),DATEVALUE(a1)=DATEVALUE(today()))
this seems to work. The date has to be parseable to date by sheets for DATEVALUE to work though.
Image has the column in an IF as well setting 1 or 0 just an example of the logic too.

How to delete a url in each string from a dataset

I have a dataset in which 1 column has the tweets and other column has labels for the tweets. My problem is I want the html links present in the tweets to be removed for example
RT #AmDiabetesAssn: Know what’s scary? These #diabetes statistics. Spread awareness this November for #DiabetesMonth! http://t.co/qIiiSc4ozZ
I have a tweet as given above i want to remove(http://t.co/qIiiSc4ozZ) and want the output in this way, for all the strings.
RT #AmDiabetesAssn: Know what’s scary? These #diabetes statistics. Spread awareness this November for #DiabetesMonth!
I have seen many examples and tried those but couldn't get the desired result. Please help. Thanks in advance.
I tried this, which should work for any links that don't have spaces in them:
for tweet in tweets:
print re.sub(r'http://\S+\s?','',tweet)
I assume here that you've got a bunch of strings in the tweets array that represent the first column that you described above (also that you want them printed). You should be able to modify to suit the iteration pattern you're using.