formula require...

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
hi all,

I need formula, where lookup values are in two different columns, and with combination of these 2 values I want to find an answer....

[TABLE="width: 453"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD]Column C[/TD]
[TD]Column D[/TD]
[TD]Column E[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD]L[/TD]
[TD]p[/TD]
[TD]q[/TD]
[TD]r[/TD]
[/TR]
[TR]
[TD]30[/TD]
[TD]L1[/TD]
[TD]10[/TD]
[TD]40[/TD]
[TD]60[/TD]
[/TR]
[TR]
[TD]31[/TD]
[TD]L2[/TD]
[TD]20[/TD]
[TD]50[/TD]
[TD]70[/TD]
[/TR]
[TR]
[TD]31[/TD]
[TD]L1[/TD]
[TD]30[/TD]
[TD]60[/TD]
[TD]80[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Value to find[/TD]
[TD][/TD]
[TD]Answer Require..[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]31[/TD]
[TD]L1[/TD]
[TD="align: right"]80[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I use this formula, but these is something wrong..
=VLOOKUP(AND(A4,B4),A2:E4,3,FALSE)
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
If you are always looking in column E

Excel 2010
ABCDE
ELpqr
L1
L2
L1
value o findanswer
l1

<colgroup><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]30[/TD]

[TD="align: right"]10[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]60[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]31[/TD]

[TD="align: right"]20[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]70[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]31[/TD]

[TD="align: right"]30[/TD]
[TD="align: right"]60[/TD]
[TD="align: right"]80[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]31[/TD]

[TD="align: right"]80[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet4

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]C7[/TH]
[TD="align: left"]{=INDEX(E2:E4,MATCH(A7&B7,A2:A4&B2:B4,0))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Is there a way to do this without using array? Just curious to know alternative ways of doing this.
 
Upvote 0
Is there a way to do this without using array? Just curious to know alternative ways of doing this.

You could use a helper column to concatenate the two columns to avoid and array formula.


Excel 2010
ABCDEF
1ELpqrhelper
230L110406030L1
331L220507031L2
431L130608031L1
5
6value o findanswer
731l180
Sheet4
Cell Formulas
RangeFormula
F2=A2&B2
F3=A3&B3
F4=A4&B4
C7=INDEX(E2:E4,MATCH(A7&B7,F2:F4,0))
 
Upvote 0
Or, using post #2 table, in C7 :

=SUMIFS(E2:E4,A2:A4,A7,B2:B4,B7)

Regards
Bosco
 
Upvote 0
I really dont understand how this works..?
Simple enter..nothing giving..
ctr shft enter ... giving me answer...I understand that this is array technology...but how...


If you are always looking in column E

Excel 2010
ABCDE
ELpqr
L1
L2
L1
value o findanswer
l1

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]30[/TD]

[TD="align: right"]10[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]60[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]31[/TD]

[TD="align: right"]20[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]70[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]31[/TD]

[TD="align: right"]30[/TD]
[TD="align: right"]60[/TD]
[TD="align: right"]80[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]31[/TD]

[TD="align: right"]80[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet4

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="width: 10"]C7[/TH]
[TD="align: left"]{=INDEX(E2:E4,MATCH(A7&B7,A2:A4&B2:B4,0))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
I really dont understand, how this too work???

it giving my answer..but worked...how..?

some Questions..

1. what IF is doing here..
2. Why column index taken 2, wherein it should be 3?



Try,

=VLOOKUP(A4&B4,IF({1,0},INDEX(A1:A4&B1:B4,0),E1:E4),2,FALSE)

Regards
Bosco
 
Upvote 0
I really dont understand, how this too work???

it giving my answer..but worked...how..?

some Questions..

1. what IF is doing here..
2. Why column index taken 2, wherein it should be 3?

=VLOOKUP(A4&B4,IF({1,0},INDEX(A2:A4&B2:B4,0),E2:E4),2,FALSE)

>>

=VLOOKUP("31L1",IF({1,0},{"30L1";"31L2";"31L1"},{60;70;80}),2,FALSE)

>>

=VLOOKUP("31L1",{"30L1",60;"31L2",70;"31L1",80},2,FALSE)

>>

=80

Regards
Bosco
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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