Getting relative value from match

kilnakorr

New Member
Joined
Nov 18, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi

Very new to excel, and trying to get a value relative to match.
Example. If my value match cell H5, I need to get value two rows down and three columns right (K7)

Anyone who can give some pointers?
 

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
You left out a lot of information needed to give you an actual formula that will work for your specific situation.
As an example let's say you are searching for the value taken from cell A1, and you are searching for an exact match in column H:

Excel Formula:
=MATCH(A1,H:H,0)

If you want to return the value two rows down and three columns to the right, use INDEX:

Excel Formula:
=INDEX(H:K,MATCH(A1,H:H,0)+2,3)

However, since we know the answer will always be in column K, we can shorten it:

Excel Formula:
=INDEX(K:K,MATCH(A1,H:H,0)+2)

It would help to give all the details of what you are doing.
 
Upvote 0
You left out a lot of information needed to give you an actual formula that will work for your specific situation.
As an example let's say you are searching for the value taken from cell A1, and you are searching for an exact match in column H:

Excel Formula:
=MATCH(A1,H:H,0)

If you want to return the value two rows down and three columns to the right, use INDEX:

Excel Formula:
=INDEX(H:K,MATCH(A1,H:H,0)+2,3)

However, since we know the answer will always be in column K, we can shorten it:

Excel Formula:
=INDEX(K:K,MATCH(A1,H:H,0)+2)

It would help to give all the details of what you are doing.
Thank you.

Yes, I might have left out information, as I'm unsure what is needed.

I have tried using =INDEX(H:K,MATCH(A1,H:H,0)+2,3), however this does not work as needed. - It 'might' find the value 3 rows down, but the column is not relative to the match.

In short. The value I need to find is never in a specific row or column. So I will always need to find the row and column relative to the match.

My match value (a date) is always in row 5, but different column.
 
Upvote 0
I have tried using =INDEX(H:K,MATCH(A1,H:H,0)+2,3), however this does not work as needed. - It 'might' find the value 3 rows down, but the column is not relative to the match.
I made one error. This formula will return the value that is 2 rows down, but the 3 means "the third column of the range where H is the first column". If you need to return the value 3 columns to the right, this number must be 4.

You need to provide a very concrete description of what you are doing. In what range are you searching for the value? What determines the number of rows and columns to offset to find the result? If the value you want to find is never in a specific row or column, MATCH isn't going to work. MATCH returns the position of a match within a single column, or a single row.

Here is an example of finding a number in a 2D array, and returning the number that is 2 rows down and 3 columns to the right.

$scratch.xlsm
ABCDEFGHIJKL
1Find number22116314661
27rows down2217324762
32columns to the right3318334863
4419344964
5Result69520355065
6621365166
7722375267
8823385368
9924395469
101025405570
111126415671
121227425772
131328435873
141429445974
151530456075
Sheet2
Cell Formulas
RangeFormula
A2A2=SUMPRODUCT(($H$1:$K$15=$E$1)*ROW($H$1:$K$15))-@ROW($H$1:$K$15)+1
A3A3=SUMPRODUCT(($H$1:$K$15=$E$1)*COLUMN($H$1:$K$15))-@COLUMN($H$1:$K$15)+1
E5E5=INDEX($H$1:$L$15,$A$2+$E$2,$A$3+$E$3)
L1L1=K15+1
L2:L15L2=L1+1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H1:L15Expression=H1=$E$5textNO
H1:K15Expression=AND(ROW(H1)=$A$2+ROW($H$1)-1,COLUMN(H1)=$A$3+COLUMN($H$1)-1)textNO
 
Upvote 0
You need to provide a very concrete description of what you are doing. In what range are you searching for the value? What determines the number of rows and columns to offset to find the result? If the value you want to find is never in a specific row or column, MATCH isn't going to work. MATCH returns the position of a match within a single column, or a single row.
I think that the main issue is that the info I need is not in a fixed column, which is why I need the relative position.
The info might be in column C one day, and next day column F and so on.

It seems there is no simple way to find a cell matching a given value, and just get the info located eg. two rows down and three columns right of that cell.

I cannot upload pictures here, without getting an 'oops something went wrong' error, so not sure how to show what I want to achieve.
 
Upvote 0
Well, I showed you exactly how to do it, and though I wouldn't call it simple, it's not that hard. How is your situation different from my example?
 
Upvote 0
This will work with numbers, but I need to get text also.
What is the difference?
In either case the solution relies on the value in E1 occurring just once in columns H:L

23 11 19.xlsm
ABCDEFGHIJKL
1Find valuevapaeatbi
27rows down2bqafaubj
32columns to the right3cragavbk
4dsahawbl
5Resultbqetaiaxbm
6fuajaybn
7gvakazbo
8hwalbabp
9ixambbbq
10jyanbcbr
11kzaobdbs
12laaapbebt
13mabaqbfbu
14nacarbgbv
15oadasbhbw
Relative value
Cell Formulas
RangeFormula
A2A2=SUMPRODUCT(($H$1:$K$15=$E$1)*ROW($H$1:$K$15))-@ROW($H$1:$K$15)+1
A3A3=SUMPRODUCT(($H$1:$K$15=$E$1)*COLUMN($H$1:$K$15))-@COLUMN($H$1:$K$15)+1
E5E5=INDEX($H$1:$L$15,$A$2+$E$2,$A$3+$E$3)
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,983
Members
449,092
Latest member
Mr Hughes

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