Add a "Right" formula to a new column

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
Here is what I tried. New at this

if(right([@Commodity],1)<>"C" then RIGHT([@Commodity],4)else LEFT((RIGHT([@Commodity],5)),4))

Thanks for the help
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
What do you mean .... if you are trying to do a formula then you put comma instead of "then" and "else"?
 
Upvote 0
Can you post some sample data and expected results?

P.S. You should probably take a look at the MID formula instead of trying to mix RIGHT/LEFT.
 
Upvote 0
I am new to adding formulas to Power Query. I am adding a new column that I want to have a formula in that uses the last 4 characters of whats in another column [Commodity]

unless the value in that column ends with the letter C. If it ends with the letter C then I was taking the last 5 characters (Left([Commodity],5) and then the first 4 of that formula

10010030 would be 0030 in the new column
101160C would be 1160 in the new column

In Excel this formula would have been:
=IF(RIGHT([@Commodity],1)<>"C",RIGHT([@Commodity],4),LEFT(RIGHT([@Commodity],5),4))

I am trying to figure out the equivalent to this formula to use in Power Query.

Hope that helps
 
Upvote 0
Is it definitely Power Query you are using?

Power Query doesn't have LEFT/RIGHT formulas.
 
Upvote 0
You could use:

Power Query:
if Text.End([Commodity],1) <> "C" then Text.End([Commodity],4) else Text.Start(Text.End([Commodity],5),4)
 
Upvote 0

Forum statistics

Threads
1,223,738
Messages
6,174,209
Members
452,551
Latest member
croud

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