Adaptation of formula without helping columns

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,362
Office Version
  1. 2010
Hello,</SPAN></SPAN>

The formula I am using for that in need to have helper columns gives result in column "K" as shown below</SPAN></SPAN>


Book1
ABCDEFGHIJKL
1
2
3n1n2Joinn1n2JoinLast Row Number
4313 | 1111 | 123
5858 | 5121 | 229
6313 | 1131 | 315
7525 | 2141 | 427
8222 | 2151 | 5
9686 | 8161 | 6
10343 | 4171 | 7
11262 | 6181 | 8
12141 | 4191 | 9
13232 | 3212 | 130
14363 | 6222 | 28
15131 | 3232 | 313
16111 | 1242 | 432
17323 | 2252 | 5
18111 | 1262 | 634
19141 | 4272 | 7
20535 | 3282 | 8
21111 | 1292 | 9
22343 | 4313 | 135
23111 | 1323 | 217
24313 | 1333 | 3
25484 | 8343 | 422
26141 | 4353 | 5
27141 | 4363 | 614
28121 | 2373 | 7
29121 | 2383 | 8
30212 | 1393 | 9
31919 | 1414 | 1
32242 | 4424 | 2
33515 | 1434 | 3
34262 | 6444 | 4
35313 | 1454 | 5
36616 | 1464 | 6
37
38
39
Sheet7
Cell Formulas
RangeFormula
F4=D4&" | "&E4
J4=H4&" | "&I4
K4{=IF(MAX((J4=$F$4:$F$4956)*(ROW($F$4:$F$4956)))=0,"",MAX((J4=$F$4:$F$4956)*(ROW($F$4:$F$4956))))}
Press CTRL+SHIFT+ENTER to enter array formulas.


I am looking does is it possible to have a new formula, which can work with out helper columns and give result in column "I" as shown below or VBA any solution</SPAN></SPAN>


Book1
ABCDEFGHIJ
1
2
3n1n2n1n2Last Row Number
4311123
5851229
6311315
7521427
82215
96816
103417
112618
121419
13232130
1436228
15132313
16112432
173225
18112634
191427
205328
211129
22343135
23113217
243133
25483422
261435
27143614
281237
291238
302139
319141
322442
335143
342644
353145
366146
37
38
Sheet8


Thank you all</SPAN></SPAN>

Excel 2000</SPAN></SPAN>
Regards,</SPAN>
Moti</SPAN></SPAN>
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Array formula (Ctrl+Shift+Enter)

=IF(MAX((G4=$D$4:$D$4956)*(H4=$E$4:$E$4956)*(ROW(F$4:$F$4956)))=0,"",MAX((G4=$D$4:$D$4956)*(H4=$E$4:$E$4956)*(ROW(F$4:$F$4956))))
 
Upvote 0
Another option:-
Based on the second Table.
Code:
[COLOR="Navy"]Sub[/COLOR] MG18Nov37
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Txt [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("D4"), Range("D" & Rows.Count).End(xlUp))
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    Txt = Dn.Value & "-" & Dn.Offset(, 1).Value
    [COLOR="Navy"]If[/COLOR] Not .exists(Txt) [COLOR="Navy"]Then[/COLOR]
        .Add Txt, Dn.Row
    [COLOR="Navy"]Else[/COLOR]
        .Item(Txt) = Dn.Row
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng.Offset(, 3)
    Txt = Dn.Value & "-" & Dn.Offset(, 1).Value
        [COLOR="Navy"]If[/COLOR] .exists(Txt) [COLOR="Navy"]Then[/COLOR] Dn.Offset(, 2) = .Item(Txt)
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Last edited:
Upvote 0
Array formula (Ctrl+Shift+Enter)

=IF(MAX((G4=$D$4:$D$4956)*(H4=$E$4:$E$4956)*(ROW(F$4:$F$4956)))=0,"",MAX((G4=$D$4:$D$4956)*(H4=$E$4:$E$4956)*(ROW(F$4:$F$4956))))
Thank you KolGuyXcel, for building a formula to work without helper columns, it is resulting fine!!</SPAN></SPAN>

Have a great weekend and good luck.
</SPAN></SPAN>

Kind regards,
</SPAN>
Moti
</SPAN></SPAN>
 
Upvote 0
Another option:-
Based on the second Table.
Code:
[COLOR=navy]Sub[/COLOR] MG18Nov37
[COLOR=navy]Dim[/COLOR] Rng [COLOR=navy]As[/COLOR] Range, Dn [COLOR=navy]As[/COLOR] Range, n [COLOR=navy]As[/COLOR] [COLOR=navy]Long,[/COLOR] Txt [COLOR=navy]As[/COLOR] [COLOR=navy]String[/COLOR]
[COLOR=navy]Set[/COLOR] Rng = Range(Range("D4"), Range("D" & Rows.Count).End(xlUp))
[COLOR=navy]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng
    Txt = Dn.Value & "-" & Dn.Offset(, 1).Value
    [COLOR=navy]If[/COLOR] Not .exists(Txt) [COLOR=navy]Then[/COLOR]
        .Add Txt, Dn.Row
    [COLOR=navy]Else[/COLOR]
        .Item(Txt) = Dn.Row
    [COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR]
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng.Offset(, 3)
    Txt = Dn.Value & "-" & Dn.Offset(, 1).Value
        [COLOR=navy]If[/COLOR] .exists(Txt) [COLOR=navy]Then[/COLOR] Dn.Offset(, 2) = .Item(Txt)
[COLOR=navy]Next[/COLOR] Dn
[COLOR=navy]End[/COLOR] [COLOR=navy]With[/COLOR]
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
Regards Mick
Thank you Mick, I liked the VBA option very much, it is more practical while using because it does not bother to adjust the ranges and live the values only. Worked like a charm </SPAN></SPAN>

Have a great weekend and good luck.
</SPAN></SPAN>

Kind regards,
</SPAN></SPAN>
Moti
</SPAN></SPAN>
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,521
Members
449,088
Latest member
RandomExceller01

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