Custom columns

Vegas01

New Member
Joined
Jun 15, 2021
Messages
43
Office Version
  1. 2019
Platform
  1. Windows
Hi everyone

I am trying to copy column M into the Custom column and I am 90% there with what I want to achieve.

I need to get the number 14 into column "Custom" by itself, the 14 is the number of weeks in a year. This is going to change each week.

As you can see in the code I currently have it is hard coded and will not work in week 15.

So how do I get this code to work for the other weeks of the year?

Thanks in advance

= Table.AddColumn(#"Filled Down", "Custom", each if [M] = "No: 14" then "No: 14" else null)

1634263886462.png
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Try the following (assuming all week cell values are starting with "No:").

Power Query:
= Table.AddColumn(#"Filled Down", "Custom", each if Text.StartsWith(Text.From([M])??"", "No:") then [M] else null)
 
Upvote 0
if you just want the number in [Custom] try

Power Query:
 = Table.AddColumn(#"Filled Down", "Custom", each if Text.StartsWith(Text.From([M])??"", "No:") then Number.FromText(Text.End([M],Text.Length([M])-4)) else null),

or

Power Query:
= Table.AddColumn(#"Filled Down", "Custom", each if Text.StartsWith(Text.From([M])??"", "No:") then Number.FromText(Text.Replace([M],"No: ","")) else null)
 
Upvote 0
Solution

Forum statistics

Threads
1,226,730
Messages
6,192,705
Members
453,748
Latest member
akhtarf3

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