Forum Discussion

GrahmSchneider13's avatar
Sep 16, 2024

Detecting Palindromes using Copilot for Excel

Hi everyone, over the last few weeks we have had a series of posts to show you some of the things that are possible to do with Copilot in Excel. Today I have a list of words and would like to detect which ones are Palindromes. What is a Palindrome? A Palindrome is a word or sequence of characters that is the same backwards and forwards. 

List of words: airplane, apple, backpack, banana, bed, bib, boat, book, bottle, building, bus, camera, car, chair, civic, clock, cloud, coffee, computer, dad, deed, deified, deleveled, desk, detartrated, door, eye

 

To get started, I ask Copilot: 

Add a column to indicate whether the words are palindromes 

Copilot in Excel pane with the above prompt

 

Looking at B2:B88, here's 1 formula column to review and insert in Column C: 

Is Palindrome 

Determines whether each word is a palindrome by checking if the word reads the same backward as forward, and returns "Yes" or "No" accordingly. 

=IF([@Words]=TEXTJOIN("",,MID([@Words],SEQUENCE(LEN([@Words]),1,LEN([@Words]),-1),1)),"Yes","No") 


I’m not sure what the formula is doing, so I click on the “Show explanation” dropdown and it says: 

Determines whether each word in the "Words" column is a palindrome by using the following steps: 

  • Uses the SEQUENCE function to generate a sequence of numbers from the length of the word down to 1. 
  • Uses the MID function to extract each character of the word in reverse order based on the sequence generated. 
  • Uses the TEXTJOIN function to concatenate the reversed characters into a single string. 
  • Compares the original word with the reversed string using the IF function. 
  • Returns "Yes" if the word is a palindrome and "No" otherwise. 

 

The suggested formula column sounds like it is doing the right thing, so I click on the button to insert the column: 

Table with 2 columns containing the list of words and a new “Is Palindrome” column with Yes and No values to indicate if it is a palindrome

 

Over the coming weeks I will continue to share more examples of what you can do with Copilot in Excel. 

 

Thanks for reading, 

Microsoft Excel Team 

 

*Disclaimer: If you try these types of prompts and they do not work as expected, it is most likely due to our gradual feature rollout process. Please try again in a few weeks. 

 

No RepliesBe the first to reply

Resources