A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
Use this formula in cell C2
=UNIQUE(REGEXREPLACE(A1:A2,"\s+",""))
Hope this helps.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello everyone,
I noticed that in Excel the Unique function is not working as expected, the explanation of this is illustrated in the following image, as I will insert a link to download the file by OneDrive at the end of this post:
When I apply the UNIQUE function on the A1:A2 range it not works as expected it shows two times 13.62! while using UNIQUE function after using TRIM function is giving the wanted result, but the problem is that neither the cell A1 or A2 has any spaces, so what is the effect of TRIM function in this case?
so isn't this considered a problem that exist in UNIQUE function in Excel? or how to solve this problem without retyping the content of the cells A1 and A2 manulally or using TRIM function?
I use Windows and I use Microsoft Office Home and Business 2024
Here is the link to download the file:
https://1drv.ms/x/c/3b862aaec36e5e46/IQBjdaZuVt4pRLFh0g14TcxiAURKtlR4Y8rMISxT80JI4To?e=C9xqam
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
Use this formula in cell C2
=UNIQUE(REGEXREPLACE(A1:A2,"\s+",""))
Hope this helps.
AI answer
UNIQUE compares the underlying values in the array, not the formatted display. If the two cells in A1:A2 contain values that are numerically different (for example, one is a number and the other is text, or they differ beyond the displayed decimal places), UNIQUE will treat them as two distinct values and will therefore return both.
TRIM works only on text. When TRIM is applied to the cells, Excel converts the values to text strings and removes any leading/trailing spaces inside those strings. After TRIM, the resulting text values become identical, so UNIQUE sees only one distinct value and returns a single result.
This behavior is by design and not a bug in UNIQUE. To avoid retyping, normalize the data before calling UNIQUE, for example by:
References: