Lookup in another table with criteria

sunnny

New Member
Joined
Jul 12, 2014
Messages
32
Hi

I am sorry for my earlier post of same heading, as this contains texts in machine language. I am posting my query again as below :

I have data across thousands of rows in Table 1 and want to match it with data in table 2 with some criteria.

Table 1

CODE
AMOUNT
70265
10,469
5844
997
5844
416
10080

10080

10080

10600
3,132
11100

11102
4,933
11102

11102
808
11102
920
11249
24,817
11447

73803
47407
11447

11504

11504

11127
11,394
11510
1,536
11510
741
11510
3,199
11510
301
47180
149
11529
531
11529
441
11529
746
11529
723
11562
559
11562
815
11579

72099
671
11579

11627

72861
7892
11651
2,812

<tbody>
</tbody>


Table 2

CODE
AMOUNT
26351
257.00
70741
1,943.00
71218
1,018.00
46935
1,02,854.00
71406
7,867.00
26979
228.00
46318
4,438.00
47180
101.00
47180
131.00
47180
199.00
12285
424.00
39102
303.00
72099
671.00
72099
11,243.00
70531
40,352.00
26373
2,13,783.00
70244
16,889.00
42385
3,419.00
73803
47,457.00
72861
7,892.00
26655
834.00

<tbody>
</tbody>


I want that if code & amount of table 2 (either amount as mentioned or amount + 50) matches with code & amount of Table 1, it should indicate in another column of table 2.

Please try to help me out.

Thank you.
 
Just noting that the reason the previous suggestions did not meet your needs is that you have now swapped your requirement around. :)

Originally you stated it as ..
2. ...OR ((Amount of Table 2 + 50) = Amount of Table 1)
.. but now you are stating that Amount of Table 1 + 50 = Amount of Table 2


The corresponding adjustment to my previous choice of formulas are shown below.

Excel Workbook
ABCDEFG
1Table 1Table 2
2
3CODEAMOUNTCODEAMOUNTRESULTRESULT
4702651046926274185NONO
5584499726351257NONO
65844416265391312NONO
710080707411943NONO
81008071215179NONO
91008071215540NONO
10106003132712181018NONO
111110046935102854NONO
121110249337103017850NONO
1311102714067867NONO
1411102808712082878NONO
151110292026979228NONO
161124924817463184438NONO
174718010147180151YESYES
184718013147180131YESYES
194718019947180199YESYES
20121851424121851474YESYES
211228542412285424YESYES
223910230339102353YESYES
234216632342166323YESYES
24442344241442344241YESYES
Check Matches
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Thanks a lot, Mr Aladin. The formula is working fine now. If any problem occurs, I'll again trouble you.

Thanks once again.
 
Upvote 0
Thanks Mr Aladin. The formula is working fine now. If any problem occurs, I'll trouble you again.

Once again thanks a lot.
 
Upvote 0
Glad to see you have a working solution, but a pity that a formula that is physically shorter, uses considerably less function calls & doesn't require CSE entry doesn't even seem to have been tried. :(
 
Upvote 0
Hello Peter_SSs Sir,

Your formula is also working fine but may be I am somewhere wrong. When I make appropriate changes in cell ranges, output is "Value".

Please find below the changes I've made :

=IF(COUNTIFS(A$2:A$3610,D2,B$2:B$56,E2)+COUNTIFS(A$2:A$3610,D2,B$2:B$56,E2-50),"YES","NO")

These changes I made after copying the appropriate columns to same sheet, otherwise column A & B are on a different sheet among multiple other columns and the same is the case with columns D & E.

I'll again try with this formula as this is easy & simple formula .
 
Upvote 0
Hello Peter_SSs Sir,

Your formula is also working fine but may be I am somewhere wrong. When I make appropriate changes in cell ranges, output is "Value".

Please find below the changes I've made :

=IF(COUNTIFS(A$2:A$3610,D2,B$2:B$56,E2)+COUNTIFS(A$2:A$3610,D2,B$2:B$56,E2-50),"YES","NO")

These changes I made after copying the appropriate columns to same sheet, otherwise column A & B are on a different sheet among multiple other columns and the same is the case with columns D & E.

I'll again try with this formula as this is easy & simple formula .
Your Table 1 either goes to row 3610 or to row 56, so the red and blue numbers should match, as they did in my posted formulas.
In post #1 you said you had thousands of rows so I assume it is row 3610 we are interested in. Therefore try

=IF(COUNTIFS(A$2:A$3610,D2,B$2:B$3610,E2)+COUNTIFS(A$2:A$3610,D2,B$2:B$3610,E2-50),"YES","NO")
 
Upvote 0
Thanks a lot perter Sir,

The formula is working fine now.

Thanks a lot again for the efforts.
 
Upvote 0
Thanks a lot Peter Sir,

The formula is working fine now.

Thanks a lot again for the efforts.
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top