Specify range in an index formula to a specific criteria

Ghesselink

New Member
Joined
Jun 7, 2018
Messages
20
Hello,

I made a table (see E2:J6) based on the data from A1:A12.
To get the data for this, I made a formula that gets the name from a specific category.
This formula is: IFERROR(INDEX($C$1:$C$4,MATCH(F2, $B$1:$B$4,0)),"")

If I drag this row to the right (so e.g. from F3:J3), the data gets filled in automatically.
However, when I drag it down I have to change the $C$1:$C$4 and $B$1:$B$4 values manually (for example to $B$5:$B$6 for the name in Category 1 - case B).

Is there a way to do this in a formula so I can drag it down. I thought by matching the range to the value in the E column, but I cannot find on how to do this.

Thanks in advance,


Screen_Shot_2018_06_07_at_22_35_32.png
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I am sorry, I forgot. It is an array formula.

1. Paste formula to cell F13
2. Press and hold CTRL + SHIFT
3. Press Enter
 
Upvote 0
You can also use a standard-entry format like this, copied across and down.

(I also suggest that you follow the link in my signature block below so that in future you can provide sample data in a form that can be copied for testing. Most helpers don't want to be bothered typing sample data so if you can make it easy for them you will get more potential helpers)

Excel Workbook
ABCDEFGHIJ
1ACategory 1Name 1
2ACategory 2Name 2Category 1Category 2Category 3Category 4Category 5
3ACategory 3Name 3AName 1Name 2Name 3Name 4
4ACategory 4Name 4BName 6Name 5
5BCategory 5Name 5CName 7Name 8Name 9
6BCategory 3Name 6DName 10Name 11Name 12
7CCategory 1Name 7
8CCategory 3Name 8
9CCategory 4Name 9
10DCategory 1Name 10
11DCategory 3Name 11
12DCategory 4Name 12
Fill Table
 
Last edited:
Upvote 0
I did your suggestion and it works now.

I will post the data and code in that way the next time, I can imagine it is easier to help with that indeed.

Thank you both for your help!
 
Upvote 0

Forum statistics

Threads
1,215,454
Messages
6,124,931
Members
449,195
Latest member
Stevenciu

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