Index/ Match/ Lookup

oO P2K Oo

New Member
Joined
Aug 12, 2018
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Thank you for viewing my post.

I am having difficulty with the index/match function.

Below is an extract of my table (I had issues uploading the table via the normal channels).

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Local code[/TD]
[TD]Age[/TD]
[TD]Universal Code[/TD]
[TD][/TD]
[TD]Local Code[/TD]
[TD]Age Boundary[/TD]
[TD]Universal Code[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]TUCEG[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD]TUCEG[/TD]
[TD]6[/TD]
[TD]ABC51A[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]TUCEG[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[TD]TUCEG[/TD]
[TD]19[/TD]
[TD]ABC51B[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]TUCEG[/TD]
[TD]19[/TD]
[TD][/TD]
[TD][/TD]
[TD]TUCEG[/TD]
[TD]19+[/TD]
[TD]ABC51C[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]TUCEG[/TD]
[TD]20[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]TUCEG[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]TUCEG[/TD]
[TD]12[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]TUCEG[/TD]
[TD]21[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]TUCEG[/TD]
[TD]17[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]TUCEG[/TD]
[TD]24[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]TUCEG[/TD]
[TD]67[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]TUCEG[/TD]
[TD]38[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]TUCEG[/TD]
[TD]0[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

The age boundary simply refers to the age in column B, if someone is 0-5 years and 364 days old they should be given a code ABC51A. If a person is 6-18 years and 364 days old they should be given a Universal code ABC51B. anyone above 19 years of age will have the code ABC51C. I can use the match function to identify the Local code, but I am struggling to link it with the age.

Can anyone help me with this issue? Many thanks in advance for your assistance with this query.

If you require any further explanations then please ask.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
In C2:

=INDEX($G$2:$G$4,MATCH(1,IF($E$2:$E$4=A2,IF($F$2:$F$4=MIN(IF($E$2:$E$4=A2,IF(B2<=$F$2:$F$4,$F$2:$F$4))),1)),0))

Enter CTRL-SHIFT-ENTER.

You will need to change 19+ to a number eg 100.
 
Upvote 0

Book1
ABCDEFG
1Local codeAgeUniversal CodeLocal CodeAge BoundaryUniversal Code
2TUCEG3ABC51ATUCEG6ABC51A
3TUCEG5ABC51ATUCEG19ABC51B
4TUCEG19ABC51CTUCEG19ABC51C
5TUCEG20ABC51C
6TUCEG6ABC51A
7TUCEG12ABC51A
8TUCEG21ABC51C
9TUCEG17ABC51A
10TUCEG24ABC51C
11TUCEG67ABC51C
12TUCEG38ABC51C
13TUCEG0ABC51A
Sheet1


Note that + in F4 is removed.

In C2 enter and copy down:

=LOOKUP(MAX(B2,MIN($F$2:$F$4)),$F$2:$F$4,$G$2:$G$4)

provided that the local code is relevant or F2:G4 is the table for TUCEG.
 
Upvote 0
Hi Aladin,

The answer is great, however, if the Local code changes, then the Universal code won't be correct. Apologies, for not giving all the local codes. I just wanted to keep it simple :-(
 
Upvote 0
Hi Aladin,

The answer is great, however, if the Local code changes, then the Universal code won't be correct. Apologies, for not giving all the local codes. I just wanted to keep it simple :-(

You can name your tables in terms of the codes involded. If you that, you can have:

=LOOKUP(MAX(B2,MIN(INDEX(INDIRECT(A2),0,1))),INDIRECT(A2))
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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