Anagrams!

Nick Burns

Member
Joined
May 24, 2017
Messages
162
Reaction score
0
Points
16
Excel Version(s)
Office 365
Whoa!
Using the function I found here, I made a query to make pseudo-anagrams out of any word/phrase.

I say "pseudo", because a true anagram has meaningful words, where as this routine merely creates all the permutations of the word/phrase.

However, I'd advise not loading this into a table or try filtering it for large words or phrases.
For instance in my attached example I'm using the words "Internal Revenue Service", 22 letters after removing spaces.
The number of permutations: 1,124,000,727,777,610,000,000
(There's a query in there to show the number of permutations for the word)


Remember, every anagram is a permutation, but not every permutation is an anagram.
It would take a bit more to this to analyze all possible words to create true anagrams.

Power Query actually did process that phrase, but I don't advise trying to sort or do a row count!

The number above shows the "TRUE" permutations, but since we have repeating letters that can be swapped it's not a new word. So that number above can be highly reduced by removing duplicates.

For instance, the word TEST has 24 true permutations. Removing the the swaps for the two 'T's, there are 12 unique permutations.

But again, I'm not going to ask PQ to remove the duplicates from a list that HUGE!
 

Attachments

  • pqAnagram.xlsx
    15.9 KB · Views: 10
Back
Top