I have 2 Cell with string. in A1 i have a 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9 and in B1 i have a 1.6, 1.7, 1.8, 1.9, 1.15, 1.16, 1.17, 1.18, 1.19. i need a formula to copy all decimal number which is available in both cell. that means in cell A1 and in Cell B1 there are same number is 1.6, 1.7, 1.8, 1.9. So, in C1 answer should be 1.6, 1.7, 1.8, 1.9.
is any one have a formula for this. Please reply. Only formula without VBA code.
| Numer 1 | number 2 | how many numbers in both cell? |
| 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9 | 1.6, 1.7, 1.8, 1.9, 1.15, 1.16, 1.17, 1.18, 1.19 | 1.6, 1.7, 1.8, 1.9 |

Vishal JoshiRank #377 · 6.7K reputationPosted Nov 11, 2022, 4:12 AM EST
Hello
You can use Intersect. please check below sample code.
static void Main(string[] args) { try { string A1 = "1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9"; string B1 = "1.6, 1.7, 1.8, 1.9, 1.15, 1.16, 1.17, 1.18, 1.19"; string C1 = string.Empty; decimal[] arrA1 = A1.Split(",")?.Select(decimal.Parse).ToArray(); decimal[] arrB1 = B1.Split(",")?.Select(decimal.Parse).ToArray(); decimal[] arrC1 = arrA1.Intersect(arrB1).ToArray(); C1 = string.Join(",", arrC1); Console.WriteLine("Numbers in both cell: " + C1); } catch (Exception e) when (e is Win32Exception || e is FileNotFoundException) { Console.WriteLine("The following exception was raised: "); Console.WriteLine(e.Message); } Console.ReadLine(); }Thank You
mukesh verma24 reputationPosted Nov 11, 2022, 4:23 AM EST
Vishal ji, Thanks for answer but Data is coming randomly using another formula and i want only Excel Formula.
I already use below formula. = TEXTJOIN(",",TRUE,IFERROR(IF(FIND(TEXTSPLIT($A$1,",",,TRUE,1,),$B$1)>0,TEXTSPLIT($A$1,",",,TRUE,1,),0),"")). but answer came 1.7, 1.8, 1.9
mukesh verma24 reputationPosted Nov 11, 2022, 3:41 AM EST
any idea??