Referring to an "Active Cell" in an INDEX MATCH formula?

dougmarkham

Active Member
Joined
Jul 19, 2016
Messages
252
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

I have a task I've not done before involving referring to an active cell within an index match formula.

Goal: to be able to click on any cell in the 'Job number' column (table 2 in sheet 2) and have that Job number used to match the job number column table 1 in the sheet 1.

Situation:
Worksheet 1 - Contains a table showing all current jobs: There are three named ranges corresponding to JobNumber, JobName and Detail.

Table 1
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]JOB NUMBER (a2)[/TD]
[TD]TASK STATUS (b2)[/TD]
[TD]JOB TYPE (c2)[/TD]
[TD]DATE (d2)[/TD]
[TD]TIME (e2)[/TD]
[TD]JOB NAME (f2)[/TD]
[TD]JOB DETAIL (g2)[/TD]
[TD]PRIORITY (h2)[/TD]
[TD]JOB DEADLINE (i2)[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]Admin[/TD]
[TD]01/12/17[/TD]
[TD]09:00[/TD]
[TD]JOB A[/TD]
[TD]LAJDFLKJDLFJSDJFLJDLJKFLDJFLKDJFLKJD[/TD]
[TD]1[/TD]
[TD]15/12/17[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]0[/TD]
[TD]Lookup[/TD]
[TD]01/12/17[/TD]
[TD]09:00[/TD]
[TD]JOB B[/TD]
[TD]AKAKLGHHAFGKLJLEGJLKAJKDGLJALKGJ[/TD]
[TD]2[/TD]
[TD]15/12/17[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]1[/TD]
[TD]Other[/TD]
[TD]01/12/17[/TD]
[TD]09:00[/TD]
[TD]JOB C[/TD]
[TD]AGLAJKLFJLKJKDGLJALRKDJLSAJDK[/TD]
[TD]3[/TD]
[TD]15/12/17[/TD]
[/TR]
</tbody>[/TABLE]












Worksheet 2 - Contains table 2 which allows me to type in a job number into column 2, and an index match formula pulls the job name from table 1.

Table 2

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]PRIORITY (B4)[/TD]
[TD]JOB NUMBER (C4)[/TD]
[TD]JOB NAME(D4)[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]JOB A[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD]JOB B[/TD]
[/TR]
[TR]
[TD]3 etc...[/TD]
[TD]3[/TD]
[TD]JOB C[/TD]
[/TR]
</tbody>[/TABLE]








What I want to do is create a fairly big cell to the right of table 2, and put an index match formula in it that will pull the JOB DETAILS corresponding to an active cell which the user will select one of the job number cells in table 2. So the idea is that the user will click on a job number in table 2 and the corresponding Job Details from table 1 will show in the big cell.

So far

Formula in C5 of table 2: =IF(C5:C294="","",INDEX(JobName,MATCH($C$5:$C$294,JobNumber,0)))
Formula in Big cell: =INDEX(Details,MATCH(Active Cell,JobNumber,0))

How do I refer to the selected cell (active cell) in table 2 column C within the index match formula in the big cell?

Kind regards,

Doug
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
The good news is that you can refer to the contents of the active cell in a formula. The bad news is that it won't update automatically when you select another cell. So your "Big cell" formula would be:

Code:
=INDEX(Details,MATCH(INDIRECT(CELL("address")),JobNumber,0))

But after selecting a job number, you'd have to hit F9 to force the calculation. The other method would be to capture the change of selection in VBA and update the cell that way.

WBD
 
Upvote 0
The good news is that you can refer to the contents of the active cell in a formula. The bad news is that it won't update automatically when you select another cell. So your "Big cell" formula would be:

Code:
=INDEX(Details,MATCH(INDIRECT(CELL("address")),JobNumber,0))

But after selecting a job number, you'd have to hit F9 to force the calculation. The other method would be to capture the change of selection in VBA and update the cell that way.

WBD

That's great! I think my team will be ok with refreshing using F9. If not, I'll set up a macro to do it lol. Thank you for your help wideboydixon!!

Just out of interest, how does INDIRECT work guys?

Kind regards,

Doug.
 
Upvote 0
CELL("address") returns the address of the active cell. E.g. "$C$5"

INDIRECT("$C$5") fetches the contents of cell C5.

WBD
 
Upvote 0
CELL("address") returns the address of the active cell. E.g. "$C$5"

INDIRECT("$C$5") fetches the contents of cell C5.

WBD

Interesting, so INDIRECT fetches what ever is in it's brackets?
Thanks for the explanation!

Kind regards,

Doug.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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