+ Reply to Thread
Results 1 to 4 of 4

M formula issue

  1. #1
    Registered User
    Join Date
    05-29-2015
    Location
    Providence
    MS-Off Ver
    2013
    Posts
    32

    M formula issue

    I am attempting to learn M and I am having trouble with a simple if statement.

    The objective is to read the last letter of each file name and produce a certain result based on that. The Formula and data range is as follows:

    CaptureHelp.PNG

    Formula - if Text.End([Name.1]) = "A" then "Actual" else if Text.End([Name.1]) = "B" then "Budget" else "Forecast"

    For some reason I am getting the following error:

    Expression.Error: 1 arguments were passed to a function which expects 2.
    Details:
    Pattern=
    Arguments=List


    Any and all help is greatly appreciated. Thanks in advance.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,604

    Re: M formula issue

    You probably need to specify how many letters you want to use in the Text.End function (similar to RIGHT in Excel). Try it like this:

    if Text.End([Name.1], 1) = "A" then "Actual" else if Text.End([Name.1], 1) = "B" then "Budget" else "Forecast"

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    06-30-2015
    Location
    Netherlands
    MS-Off Ver
    2013 / 2016 / 365
    Posts
    145

    Re: M formula issue

    Hi,

    Pete_UK is right!

    The Text.End statement applies to the Power Query Formula Language (informally known as "M").
    Take a look at this: https://msdn.microsoft.com/en-us/library/mt253341.aspx
    HtH,

    Joris

    --------------------------------------------------------------------------------
    If you found my answer helpful, please hit the Like or Thank button.

    Please follow the forum Rules and Guidelines and use Code tags around your VBA code.

    Remember: test VBA code always on a copy of your file because usually you can't use undo

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,576

    Re: M formula issue

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Index Match Formula Issue - Lookup Value is a Formula
    By dodgemain in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-06-2016, 11:48 AM
  2. formula issue in VBA
    By cmccabe in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-26-2014, 04:50 PM
  3. [SOLVED] Issue with For Each Formula
    By justinpeeler in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-21-2014, 04:52 PM
  4. Lookup Formula Issue, Search issue
    By kperitz in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-07-2014, 01:50 PM
  5. Excel 2008 : Help with a formula issue.
    By dravenkai in forum Excel General
    Replies: 2
    Last Post: 09-02-2011, 07:14 PM
  6. An issue regarding the formula
    By HuaMin in forum Excel General
    Replies: 2
    Last Post: 12-07-2005, 11:45 AM
  7. An issue regarding the formula
    By HuaMin in forum Excel General
    Replies: 0
    Last Post: 12-07-2005, 08:35 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1