LOOKUP or MATCH/INDEX?

delboy275

New Member
Joined
May 5, 2022
Messages
15
Office Version
  1. 2016
Platform
  1. Windows
Hi, I am using Excel 2016.

Question I have a table on sheet 1. first cell (B8) has a drop down list of distances 0 – 99, 100 - 199, 200 -299 etc. Second cell (C8) has drop down list of “types” A, B , C etc.

Sheet 3 has 3x different tables all with the same distances and a separate array list of “types”,

(1 array list of distances 0 – 99, 100 - 199, 200 -299 for types A & E types. (B3:L15)

1x array list of distances 0 – 99, 100 - 199, 200 -299 for types B, C, F & & G types (B18:L30)

1x array list of distances 0 – 99, 100 - 199, 200 -299 for types D & H types) (B33:L45)

I want the formulae to check which “distance” has been selected in cell B8, then check which “type” has been selected in cell C8, then select which of the three tables on sheet 3 to lookup use to output the correct value.

(Note: Sheet 3 has a list of distances down the left side and corresponding values to the right of the distances).



I will try and write it in plain english:

If (B8) is 0-99 metres and (C8) is type A or E then VLOOKUP table Sheet 2, (B3;L15) or

If (B8) is 100-200 metres and (C8) is type A or E then VLOOKUP table Sheet 3, (B4;L11) or



Also should this be done using VLOOKUP/HLOOKUP or MATCH/INDEX?

I am tying myself in knots.

Thanks in advance.

Del
 
Hi Alex.
Does your formulae require the 3x lookup tables to be on the same sheet as the input table as mine are currently on another sheet?

Secondly, how did I copy and paste the tables to show the column and row numbers as you have done above?

Regards.
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Does your formulae require the 3x lookup tables to be on the same sheet as the input table as mine are currently on another sheet?
No they don't need to be on the same sheet.
One of the benefits of using Excel Tables is that their names have a scope of workbook. That is to say that when you reference them in a formula using Table referencing (Table Name and Column Name) you don't need to include a reference to the sheet name.

how did I copy and paste the tables to show the column and row numbers as you have done above?
I think you are referring to this:-
(Note: The orange download button is in the top right hand corner of the linked page)

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Can we take this a little further.
Cell H4
After checking cell B4 (550-649), then checking cell C4 ( frequency A in this instance) then after finding the correct table it needs to find the nearest match horizontally to the value in G4 (109.09), (in this instance the (closest match is 100), then display the value at the top of the column (i.e 200 in this instance.).
Hope this makes sense.
Are you on WhatsApp or messenger in case you have any questions?
I am not sure if we are allowed to put contact info on here.
 

Attachments

  • IMG_0638.jpg
    IMG_0638.jpg
    44.5 KB · Views: 10
  • IMG_0639.jpg
    IMG_0639.jpg
    83.7 KB · Views: 10
Upvote 0
Can we take this a little further.
Cell H4
After checking cell B4 (550-649), then checking cell C4 ( frequency A in this instance) then after finding the correct table it needs to find the nearest match to the value in G4 (109.09) horizontally, (in this instance the (closest match is 100), then display the value at the top of the column (i.e 200 in this instance.).
Hope this makes sense.
Are you on WhatsApp or messenger in case you have any questions?
I am not sure if we are allowed to put contact info on here.
 
Upvote 0
EBI Track 200 Calculations.xlsx
ABCDEFGHIJ
1EBI 200 CALCULATIONS
2
3TRACK LENGTH (M)FREQTX (Highest) VRX (Lowest) VRATIO ATRACK ΩΩ/KM
4550-649A1.21.11.09109.09#N/A
5
6
EBI200
Cell Formulas
RangeFormula
F4F4=SUM(D4/E4)
G4G4=SUM(D4/E4*100)
H4H4=VLOOKUP($B4,INDIRECT(VLOOKUP($C4,EBI200_TRACK_TABLE,2,FALSE)),2,FALSE)
Cells with Data Validation
CellAllowCriteria
B4List=TrackLengths!$D$5:$D$20
C4List=TrackLengths!$I$5:$I$13



EBI Track 200 Calculations.xlsx
BCDEFGHIJKL
3Track Length (m)NORMAL POWER FREQUENCIES A and E BALLEST IMPEDANCE ΩkM
42 Ωkm3 Ωkm4 Ωkm5 Ωkm6 Ωkm8 Ωkm101520200
5ΩkmΩkmΩkmΩkm
6200-24989929495969798989999
7250-349818790929395969798100
8350-449738186889093949697100
9450-549637480848790929596100
10550-649546674798287899395100
11650-749445867737783869194100
12750-849365059667178838992100
13850-949294252606574798690100
14950-1049243645535968748388100
15050-1100193039475363708086100
16Table 21 Normal Power Frequencies A and E Ballast Impedance
17
18Track ength (m)Normal Power Frequencies B, C, F and G Ballast Impedance Ωkm
192 Ωkm3 Ωkm4 Ωkm5 Ωkm6 Ωkm8 Ωkm101520200
20ΩkmΩkmΩkmΩkm
21200-249859092949596979898100
22250-349768387909193959797100
23350-449657581858791929596100
24450-549546674798287909395100
25550-649435766727783869194100
26650-749344857657077828992100
27750-849273949576372778690100
28850-949213242505666728287100
29950-1049172735434959677884100
30050-1100132230374353617481100
31Table 22 Normal Power Frequencies B, C, F and G Ballast Impedance
32
33Track ength (m)Normal Power Frequencies D and H Ballast Impedance Ωkm
342 Ωkm3 Ωkm4 Ωkm5 Ωkm6 Ωkm8 Ωkm101520200
35ΩkmΩkmΩkmΩkm
36200-249818790929395969798100
37250-349718084878992949697100
38350-449607178828588919496100
39450-549486170757984889294100
40550-649385261687379848992100
41650-749304353606674798690100
42750-849233544525868748388100
43850-949182837455161687985100
44950-1049142331384555627582100
45050-1100111926333949577078100
46Table 23 Normal Power Frequencies D and H Ballast Impedance
NormalPower (2)
 
Last edited:
Upvote 0
The XL2BB of NormalPower (2) does not look like they are Excel Tables. Excel Tables would have trashed your merged cells which are considered to be very bad practice by most experienced excel users.

I am on MS 365 so I don't know whether some formulas only work on my version or whether they will work on your Office 2016.
Put the formula below anywhere on NormalPower (2) (or the sheet with those 3 tables on them) and see if works. On my laptop it returns 93 (it is using 550-649 & 94 as the lookup values).
If it works and doesn't error out then I will explain how to implement a formula based around that formula.

Rich (BB code):
=INDEX(INDEX($B$6:$L$15,MATCH("550-649",$B$6:$B$15,0),0),MATCH(94,INDEX($B$6:$L$15,MATCH("550-649",$B$6:$B$15,0),0),1))

I do need to know that:
  • You have created a mapping table called EBI200_TRACK_TABLE
  • Hit Ctrl+<F3> it will bring up the name manager. Make sure the Names and RefersTo columns are wide enough to show the full content. Take a screen shot and post it in your reply.
  • Confirm that the sheet NormalPower (2), is your current sheet name for your 3 tables and that the XL2BB data sheet is accurrate ie Table 1 starts in B3 and Table 3 ends in L45 with the table name in row 46
 
Upvote 0
I had to upgrade yesterday to MS365 as XL2BB kept crashing my office 2016, so what I sent you yesterday was MS 365 version.
I used the name manager to show the table and it shows it as EBI200_TRACK_TABLE covering cells B3-L46. (the 3 tables are as exactly as shown in the example I sent you yesterday; Although the 3 tables are shown separately with each section named below it, they are all actually grouped as one called "EBI200_TRACK_TABLE"
I put your new formula on the input sheet cell H4 and it came up with a value of 1.090909.
I then entered your formulae on the mapping sheet with the three tables and it came up with a value of 93
BTW I have a NORMALPOWER sheet and a NORMALPOWER (2) sheet which for testing out your formulas. That is the correct names.
The input sheet is called EBI200.
See name manager photos attached.
 

Attachments

  • IMG_0652.jpg
    IMG_0652.jpg
    68.5 KB · Views: 7
  • IMG_0653.jpg
    IMG_0653.jpg
    69.2 KB · Views: 6
Upvote 0
You don't seem to have created the mapping table we discussed.
Please create this table and give it a name and tell me what that name is.

20220505 Select Different Lookup Table delboy275.xlsx
OP
3TypesTable
4A1
5B2
6C2
7D3
8E1
9F2
10G2
11H3
OPs Data Power
 
Upvote 0
Sorry I will have to look that up as I have no idea what a mapping table is.
 
Upvote 0
Copy that table (above) into your workbook, it doesn't matter where.
Click inside the table and hit Ctrl+T, click the "it has headings box"
Click on Table Design and in the far left corner in the Name box, copy in this name TYPEMapping

Once done then in H4 of EBI200 copy in the formula below.

I am about to log off it is nearly 1am here.

Excel Formula:
=CHOOSE(VLOOKUP($C4,TYPEMapping,2,FALSE),
INDEX(INDEX(NormalPower!$B$6:$L$15,MATCH($B4,NormalPower!$B$6:$B$15,0),0),MATCH($G4,INDEX(NormalPower!$B$6:$L$15,MATCH($B4,NormalPower!$B$6:$B$15,0),0),1)),
INDEX(INDEX(NormalPower!$B$21:$L$30,MATCH($B4,NormalPower!$B$21:$B$30,0),0),MATCH($G4,INDEX(NormalPower!$B$21:$L$30,MATCH($B4,NormalPower!$B$21:$B$30,0),0),1)),
INDEX(INDEX(NormalPower!$B$36:$L$45,MATCH($B4,NormalPower!$B$36:$B$45,0),0),MATCH($G4,INDEX(NormalPower!$B$36:$L$45,MATCH($B4,NormalPower!$B$36:$B$45,0),0),1)))
 
Upvote 0
Solution

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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