Skip to main content
14-Alexandrite
July 23, 2025
Solved

Match numbers betweeen two arrays to get the index

  • July 23, 2025
  • 1 reply
  • 504 views

Hello,

 

I have two arrays H and H_end.Pile_vec.total. I am trying to match the numbers between these two arrays and get the corresponding index number from H_end.Pile_vec.total. I have used the match function whic works for the first one only and not for the rest. Please help. My version is Prime 10.

fahmed2_0-1753293981943.png

 

Best answer by Werner_E

Hmmm, that way?

Werner_E_0-1753296704437.png

or maybe better

Werner_E_1-1753296807888.png

in case all values in H are to be found in H.end.Pile

 

 

1 reply

25-Diamond I
July 23, 2025

Its not clear what you mean by "match the numbers between these two arrays".

The error you get is easy to explain:

Werner_E_0-1753294681533.png

You will only find a match for the first three values in H and you can trap the error using "try...on error.."

Werner_E_1-1753294915353.png

 

So you would have to explain in more detail what you actually are trying to achieve.

 

fahmed-214-AlexandriteAuthor
14-Alexandrite
July 23, 2025

Thanks @Werner_E . This is what I needed. Based on H_end.Pile_vec.total, it will match with H and extract the indexes. How to stop at the last found index and not to show "NaN"s. Also, would later extract the arrays as values.

 

Thanks

Werner_E25-Diamond IAnswer
25-Diamond I
July 23, 2025

Hmmm, that way?

Werner_E_0-1753296704437.png

or maybe better

Werner_E_1-1753296807888.png

in case all values in H are to be found in H.end.Pile