# Help matching rows

1. ## Help matching rows

Hi,

I need help matching the X (column A) and Y (column B) variables in the attached file with INDEX(MATCH) but I'm failing at the MATCH part.

The situation:
Both, X and Y can be numbers or numbers mixed with text. The Y variables always have 6 digits but the first digit might be a leading 0. The Y variables should represent the first 6 digits of the X variables, but the X variables should not have the leading 0.

The approach:
After removing the leading 0 from the Y variable (column C) I tried the following:

1) comparing Y with the left part of X, which is dependent on the length of Y
= Match (Y; Left (X; Length (Y);0)

2) I wasn't sure MATCH would work with LENGTH and LEFT, so I tried shortening X to the length of Y first (column G and H) and then match column B with G and H.
G = Left (X; 6)
H = Left (X; 5)
= Match (Y; G; 0)
= Match (Y; H; 0)

3) instead of of comapring X and Y with the same number of digits, I tried comparing Y* with X
= Match (Y & "*"; X;0)

None of my ideas work properly. I'm not sure why - might be due to formatting but I haven't been able to solve it that way. Any ideas?

Thank you.

2. ## Re: Help matching rows

no longer important

3. ## Re: Help matching rows

To attach a file to your post,
click advanced (next to quick post),
scroll down until you see "manage file",
click that and select "add files" (top right corner).
click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

Once the upload is completed the file name will appear below the input boxes in this window.
You can then close the window to return to the new post screen.

4. ## Re: Help matching rows

Thanks. It's uploaoded now. I always pressed Attachements in the Text Editor and a small, blank window popped up. Pressing Manage Attachements further down below worked.

5. ## Re: Help matching rows

Maybe this in D2, copied down:

=IF(B2="","",IFERROR(1/(1/SUMPRODUCT(--ISNUMBER(SEARCH(IFERROR(B2+0,B2),\$A\$2:\$A\$300)),ROW(\$A\$2:\$A\$300))),""))

6. ## Re: Help matching rows

Try in E2:
``Please Login or Register  to view this content.``
Drag down

7. ## Re: Help matching rows

Thank you. Both solutions seem to be working. Solution 1 should also work with several leading zeroes.

bebo021999: Can you explain what the index function does in =index(1 ; )=1? What does the empty argument represent?

Can someone tell me why my match function didn't work? Below is an abbreviated version: seaching for 459200 in column A. When I format column A as a number, text or general, then MATCH shows me an error (see top half). But when I add +0 to column A, the match function works fine (see bottom half). What's the difference between formatting a cell as a number and adding +0?

458683 459200 =MATCH(\$B\$1;\$A\$1:\$A\$2;0) = #NA
459200

=A1+0 459200 =MATCH(\$B\$4;\$A\$4:\$A\$5;0) = 2
=A2+0

8. ## Re: Help matching rows

Originally Posted by Iwantto
bebo021999: Can you explain what the index function does in =index(1 ; )=1? What does the empty argument represent?
``Please Login or Register  to view this content.``
Let's say:
X=IF(LEFT(B2)="0",MID(B2,2,255),B2) will change 012345 into 12345, or 456789 into itself
SEARCH(X,\$A\$2:\$A\$300) will search X string in A2, A3, ...then A300
for instant: X=1234; A3=123456
SEARCH(X,A3)=1 (X string is found at 1st position in A3)
so, SEARCH(X,\$A\$2:\$A\$300) establish (0,1,0,0,...,0), (let's say: Y)
then, MATCH(1,Y,0) will return pos of 1 in Y array
This is array formula, confirmed by ctrl-shift-enter (CSE)
To avoid CSE, wrap Y inside INDEX function:
=MATCH(1,INDEX(Y,),0)
This is my final formula

Hope it helps

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1