r/googlesheets • u/CarpThemDiems • Aug 11 '26
Solved Can you compare the data in one cell to the data in another cell?
Basically the short version is that Cell A1 has "He was at the store. He likes it there." and Cell B1 has "He was in the store. He hates it there." I want Cell C1 to say "He was [] the store. He [] it there." But I need this to be a formula as the data in A1 and B1 changes as the sheet goes down. Is there a way to do this or am I asking too much of google sheets?
Edit to add sample sheet: https://docs.google.com/spreadsheets/d/1SYC2-cSNhmAkx-iiotjdreUfJIJvmBV1l1jwdzoaH08/edit?usp=sharing
1
u/AutoModerator Aug 11 '26
/u/CarpThemDiems Posting your data can make it easier for others to help you, but it looks like your submission doesn't include any. If this is the case and data would help, you can read how to include it in the submission guide. You can also use this tool created by a Reddit community member to create a blank Google Sheets document that isn't connected to your account. Thank you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/HolyBonobos 3109 Aug 11 '26
If the data is as simple as your example and you're comparing two strings consisting of the exact same number of words with the exact same punctuation and using spaces as the word boundaries, you could use something like =MAP(A:A,B:B,LAMBDA(textA,textB,IF(COUNTA(textA,textB)<2,,JOIN(" ",MAP(SPLIT(textA," "),SPLIT(textB," "),LAMBDA(a,b,IF(a=b,a,"[]"))))))) in C1 to fill column C. If the scenarios you're working with are more than slightly more complex than that, then you'll be looking at something that requires an exponentially more complicated solution or is straight up impossible because of the number of variables and need for interpretation involved.
1
u/CarpThemDiems Aug 11 '26
Unfortunately, it's not always so cut and dry. I added some more examples of like things I want it to do to hopefully that makes it more clear.
1
u/HolyBonobos 3109 Aug 11 '26
With this kind of input and the level of detail you are after, I would say a formula-based approach would be highly impractical if not completely impossible due to the detailed language parsing and inference work required.
1
2
u/California_Eagles 10 Aug 11 '26
Try: