Share via

Excel Mid function within substitute

Anonymous
2024-07-13T14:08:55+00:00

Hello,

Bit stuck,

If i want to substute text values using REDUCE / LAMBDA,

but I want to exclude the first x characters before the "/", so I thought I'd use search ;

= LET( s, SEARCH("/",C3)+1,MID(C3,s, LEN(C3)-s) )

But when I put this within the REDUCE lambda, so the cell reference is replaced by x variable
i keep getting an error?

so =REDUCE(C3,CHAR(SEQUENCE(26,1,97,1)),LAMBDA(x,y, x ) ),

would return text in cell C3 =x but when put into search I get an error,

REDUCE(C3,CHAR(SEQUENCE(26,1,97,1)),LAMBDA(x,y, SEARCH("/",x) ))

so is there a way I can exclude all before and including "/" and then just return the remaining numbers?

Richard.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. riny 20,870 Reputation points Volunteer Moderator
    2024-07-14T13:23:13+00:00

    Not sure why you want to go for the complicated REDUCE/LAMBDA method, but that's your choice of course.

    You also need to exclude CHAR(32) and CHAR(45) for space and hyphen.

    This one should work:

    =LET(

    start, SEARCH("/",C3)+1,

    t, MID(C3,start,LEN(C3)-start),

    REDUCE(t, VSTACK(CHAR({32;45}),CHAR(SEQUENCE(26,,97,1))),LAMBDA(x,y, SUBSTITUTE( LOWER(x ),y,"") ))

    )

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-07-14T11:21:50+00:00

    I did state it 'If i want to substitute text values using REDUCE / LAMBDA,,

    also re format could you give an example as I don't know what you mean, I put the formula I used in three different ways, screen shot, just copied and Formulatext, also I did show the result in the second post, I could not show result in the first aa I did not have a one.

    Was this answer helpful?

    0 comments No comments
  3. Ashish Mathur 102K Reputation points Volunteer Moderator
    2024-07-13T23:23:39+00:00

    Hi,

    What exactly are you trying to do? State that upfront first rather than just posting a formula. Also, share data in a format that can be pasted in an MS Excel file and show the expected result clearly. Sharing an image is useless.

    Was this answer helpful?

    0 comments No comments
  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  5. Anonymous
    2024-07-13T14:28:03+00:00

    I have since declared as variable within a let statement; outside of the REDUCE and this seems to work,

    sitll not right as I need to get rid of -

    =LET(start,SEARCH("/",C3)+1, t, MID(C3,start,LEN(C3)-start),

    REDUCE(t, CHAR(SEQUENCE(26,,97,1)),LAMBDA(x,y,

    SUBSTITUTE( LOWER(x ),y,"") )))

    so If there is a better way that would deal this please let me know,

    Richard

    Was this answer helpful?

    0 comments No comments