Index Match Issue with horizontal record

mianmithu

New Member
Joined
Jan 13, 2020
Messages
24
Office Version
  1. 365
  2. 2010
  3. 2007
Platform
  1. Windows
I am sorry to bother if its a simple question but i got a trouble doing this stuff

Here i got the Data like this

ABCD
PkUSAUKAus
1234
IndTurCanNep
5678

I Want results (Name of Country) in E2 if i put the number (given digits) in E1
E.g. if i put number 7 in E1, The result in E2 must be Can.

P.s, I want Formula instead of VB Code.
I am trying Index match but its not giving me results but an error. Plz help
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
For ex. like that:

Code:
=INDEX(A1:D4,SUM(IF(A1:D4=E1,ROW(A1:D4)-1,0)),SUM(IF(A1:D4=E1,COLUMN(A1:D4),0)))

accept it with Ctrl+Shift+Enter (not just Enter as usual)
 
Upvote 0
Or a regular formula
Code:
=INDEX($A$1:$D$4,INT((E1-1)/4)*2+1,MOD(E1-1,4)+1)

MATCH can only find a result in a single row or column, with multiple rows or columns you wil get an error.
 
Upvote 0
Perfect, its an array now.
It worked (y)

Thanks very much Kokosek :) God bless you
 
Upvote 0
Indeed Jason. Anyhow in case of multiple matching data your formula 'could' give unexpected result.
@ mianmithu - please check Jason's post about multiple data and consider also his solution.
 
Upvote 0
its only working in case i have data till column D, if i put more data in E, F... it will not work as it has nothing to do with the given number in A2 and A4, but it is counting the Cells from left to right till 4 and then again from A in the 2nd next row
Or a regular formula
Code:
=INDEX($A$1:$D$4,INT((E1-1)/4)*2+1,MOD(E1-1,4)+1)

MATCH can only find a result in a single row or column, with multiple rows or columns you wil get an error.
 
Upvote 0
In that case, KOKOSEK's formula is also likely to fail, by using different values in rows 2 and 4, #REF! errors are not uncommon.

edit:- ignore that, the errors were caused by duplicates, anything else works fine.
 
Last edited:
Upvote 0
In that case, KOKOSEK's formula is also likely to fail, by using different values in rows 2 and 4, #REF! errors are not uncommon.

No brother,

=INDEX(A1:D4,SUM(IF(A1:D4=E1,ROW(A1:D4)-1,0)),SUM(IF(A1:D4=E1,COLUMN(A1:D4),0)))
Change it into it, and it is no trouble.

=INDEX(A1:H8,SUM(IF(A1:H8=K1,ROW(A1:H8)-1,0)),SUM(IF(A1:H8=K1,COLUMN(A1:H8),0)))
 
Upvote 0

Forum statistics

Threads
1,215,494
Messages
6,125,139
Members
449,207
Latest member
VictorSiwiide

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