Help regarding finding data in Excel Table.

Surajgyl

New Member
Joined
Nov 11, 2017
Messages
8
Hello everyone,

I need help in finding some data in excel table, I have a table as follows:-

L1L2L3L4
17700179001820019200
18200184001870019800
18700190001930020400
19300196001990021000

<tbody>
</tbody>

So all i want to do is find a particular column (L1 OR L2 OR L3 OR L4) based on value of a cell, than after finding the column i want to find data equal to or next greatest value in that particular column. For example i have a cell named level in different sheet and value of that cell is L2, so first i want to find for L2 in this given(i.e. column) table and than after finding the column(which is 2nd column in this case) i want to search 18399 or next greatest value in that column L2(which is 18400). I dont have much knowledge of excel formulas but i tried lookups and indexing matching but none of them worked in my case. Kindly help me in this problem. It will save so much of my time at my work.

Thanks.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Row\Col
A​
B​
C​
D​
E​
F​
G​
H​
1​
L1 L2 L3 L4L2
18399​
18400​
2​
17700 17900 18200 19200L3
19300​
19300​
3​
18200 18400 18700 19800L3
19000​
19300​
4​
18700 19000 19300 20400
5​
19300 19600 19900 21000

In H1 enter and copy down:

=INDEX($A$2:$D$5,MATCH($G1,INDEX($A$2:$D$5,0,MATCH($F1,$A$1:$D$1,0)),1)+(LOOKUP($G1,INDEX($A$2:$D$5,0,MATCH($F1,$A$1:$D$1,0))) < $G1),MATCH($F1,$A$1:$D$1,0))
 
Upvote 0
Row\Col
A​
B​
C​
D​
E​
F​
G​
H​
1​
L1 L2 L3 L4L2
18399​
18400​
2​
17700 17900 18200 19200L3
19300​
19300​
3​
18200 18400 18700 19800L3
19000​
19300​
4​
18700 19000 19300 20400
5​
19300 19600 19900 21000

In H1 enter and copy down:

=INDEX($A$2:$D$5,MATCH($G1,INDEX($A$2:$D$5,0,MATCH($F1,$A$1:$D$1,0)),1)+(LOOKUP($G1,INDEX($A$2:$D$5,0,MATCH($F1,$A$1:$D$1,0))) < $G1),MATCH($F1,$A$1:$D$1,0))

Thank you sir, i will try it out and inform you about the result.Actual data is bigger this table is just for illustration
 
Upvote 0
Thank you so much for your help sir. It worked in my case. Now can you explain the basic logic behind this formula so i can use it in my future work. Thanks again.
 
Upvote 0
Surajgyl,

two more solutions.
Code:
[COLOR=#000000][FONT=Arial]{=INDEX($A$2:$D$5,[/FONT][/COLOR][COLOR=#008000][FONT=Arial]MATCH(TRUE,[COLOR=#0000FF]INDEX($A$2:$D$5,0,[COLOR=#FF0000]MATCH(F1,$A$1:$D$1,0)[/COLOR])[/COLOR]>=G1,0)[/FONT][/COLOR][COLOR=#000000][FONT=Arial],[/FONT][/COLOR][COLOR=#008000][FONT=Arial]MATCH(F1,$A$1:$D$1,0)[/FONT][/COLOR][COLOR=#000000][FONT=Arial])}[/FONT][/COLOR]
Code:
[COLOR=#000000][FONT=Arial]=AGGREGATE(15,6,$A$2:$D$[/FONT][/COLOR][COLOR=#008000][FONT=Arial]5/($A$1:$D$1=F1)[/FONT][/COLOR][COLOR=#008000][FONT=Arial]/($A$2:$D$5>=G1)[/FONT][/COLOR][COLOR=#000000][FONT=Arial],1)[/FONT][/COLOR]
 
Upvote 0
Thank you so much for your help sir. It worked in my case. Now can you explain the basic logic behind this formula so i can use it in my future work. Thanks again.

In

=INDEX($A$2:$D$5,MATCH($G1,INDEX($A$2:$D$5,0,MATCH($F1,$A$1:$D$1,0)),1)+(LOOKUP($G1,INDEX($A$2:$D$5,0,MATCH($F1,$A$1:$D$ 1,0))) < $G1),MATCH($F1,$A$1:$D$1,0))

this bit

[a] INDEX($A$2:$D$5,0,MATCH($F1,$A$1:$D$1,0))

determines the range that corresponds to the desired level. If the level to look for is L2, the range will be all of the cells in B2:B5. The MATCH here delivers the column and the first 0 means all of the cells of that column in the data range (A2:D5).
If we rewrite the formula in terms of what we now know, we get:

=INDEX($A$2:$D$5,MATCH($G1,levelrange,1)+(LOOKUP($G1,levelrange) < $G1),MATCH($F1,$A$1:$D$1,0))

This MATCH bit

MATCH($G1,levelrange,1)

matches a numeric value like 18399 against levelrange with match-type = 1 (approximate match), delivering the relative row number of the cell housing the approximate number, which is either equal to 18399 or a closest value less than 18399 in levelrange (Note that, in B2:B5, 17900 is that closest value.). The relative row number this foregoing MATCH delivers is: 1.

Since you want 18399 if available, otherwise the first value larger than 18399, which, by the way, would be 18400 in B2:B5. We need thus the relative row number 2 at which 18400 is located.

If we can add a 1 to the result of , we would get 2, the location of 18400.

[c] The test

LOOKUP($G1,levelrange) < $G1

delivers TRUE if the approximate look up for 18399 is less than 18399, othwerwise FALSE obtains. Since LOOKUP(18339,levelrange) >> 17900, we get TRUE.

Note that adding TRUE to , i.e. 1 + TRUE >> 2. Note also that 1 + FALSE >> 1. (TRUE is 1, FALSE is 0 in Excel.)

We need to observe that:

MATCH($G1,levelrange,1)+(LOOKUP($G1,levelrange) < $G1)

gives us the relative row number we are interested in. Let's call this intermediate result ROW.

Now we have:

=INDEX($A$2:$D$5,ROW,MATCH($F1,$A$1:$D$1,0))

Since MATCH($F1,$A$1:$D$1,0) yields a relative column number, let's call this result COLUMN.

We finally have

=INDEX($A$2:$D$5,ROW,COLUMN)

that gives us 18400, the value we wanted.

You could also use 'evaluate formula' or F9 to dissect how the proposed formula evaluates.
 
Upvote 0

Forum statistics

Threads
1,216,468
Messages
6,130,800
Members
449,595
Latest member
jhester2010

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