Skip to content

Instantly share code, notes, and snippets.

@MeniPorat
Created February 28, 2022 15:29
Show Gist options
  • Select an option

  • Save MeniPorat/143644e33eb55cc68082c5e065a4655a to your computer and use it in GitHub Desktop.

Select an option

Save MeniPorat/143644e33eb55cc68082c5e065a4655a to your computer and use it in GitHub Desktop.
REVERSESTR - An alternativr LAMBDA Function to reverse a string in EXCEL
Here is an alternative to the LAMBDA function: TEXTREVERSE (suggested by Chris Gross)
It is much shorter than the original
/*
FUNCTION NAME: REVERSESTR
AUTHOR: Meni Porat
DESCRIPTION: Reverses a string
ARGUMENSTS:
string: text string to be reversed
EXAMPLE:
=REVERSESTR("four score and seven years ago")
*/
REVERSESTR =LAMBDA(string,
let(strlen,LEN(string),
IF(strlen=0,string,
CONCAT(MID(string,SEQUENCE(strlen,1,strlen,-1),1)))))
/*
FUNCTION NAME: REVERSESTR
AUTHOR: Meni Porat
DESCRIPTION: Reverses a string
ARGUMENSTS:
string: text string to be reversed
EXAMPLE:
=REVERSESTR("four score and seven years ago")
*/
REVERSESTR =LAMBDA(string,
let(strlen,LEN(string),
IF(strlen=0,string,
CONCAT(MID(string,SEQUENCE(strlen,1,strlen,-1),1)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment