Replace all Numbers with null

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,922
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm stuck trying to code: If [Label] does not contain ".0" Then [Sum] = null, Else [Sum] = [Sum]

{Sum] contains null or whole numbers only, range -100 to 10 (Max always 10, potential minimum -infinite, -100 as proxy)

This works only for -8
Power Query:
=Table.ReplaceValue(#"Filter Rows", -8, null, Replacer.Replace.ReplaveValue,{"Sum"})

This works for whole numbers (not tested for > 9)
Power Query:
=Table.ReplaceValue(#"Filter Rows", {0..9}, null, Replacer.Replace.ReplaveValue,{"Sum"})
But doesn't work for negative numbers (I tried {-9..9} as well)

Ultimately, I'm trying to achieve
Power Query:
"Each If [ColA] does not contain ".0" Then Null Else [Sum]"
But can't figure out the M code

TIA,
Jack
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Is [Label] a text column and is [Sum] a column ?
If that's the case why not just use Add Column > Conditional Column

Power Query:
= Table.AddColumn(#"Renamed Columns", "NewColumn", each if not Text.Contains([Label], ".0") then null else [Sum])
 
Upvote 0
Solution
Hi, I discovered this later and it does work, thank you for suggesting :)
 
Upvote 0

Forum statistics

Threads
1,223,718
Messages
6,174,082
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top