Dynamic cell and sorting

Polanskiman

Board Regular
Joined
Nov 29, 2011
Messages
119
Office Version
  1. 365
  2. 2016
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
  2. MacOS
  3. Mobile
So here is the deal. I need that cell in E4 to be dynamic because the "Description" column on the Excel table is supposed to be sortable. By dynamic I mean that no matter the order of the Excel table, cell E4 should always report the correct tag associated to the description. How can I achieve that?

Any help would be appreciated.

Thank you.

Book1.xlsx
BCDEFGHI
1
2In Sheet 1In Sheet 2In Sheet 3
3
4Product 1Product 1 newDescriptionTag
5Product 2Product 1new
6Product 3Product 2old **
7Product 4Product 3used
8Product 5Product 4
9Product 6Product 5
10Product 6new
11Product 7
12Product 8
13
Sheet2
Cell Formulas
RangeFormula
E4E4=Sheet2!C4&" "&Sheet2!H5
 
Thank you I will try to implement it that way. Will report when I am done.
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
My suggestion would be this.
  • Also include a helper column in the table as shown below. If you want, this column could be hidden once you have entered the formula.

I am trying to make this helper column but running into some issues. Do the two tables (table 1 and table 3) need to be the size, row wise?
 
Upvote 0
=MATCH([@Fertilizer],Sheet1!C$5:C$12,0)+COUNTIF(INDEX([Fertilizer],1):[@Fertilizer],[@Fertilizer])/10^6
After some fiddling it seem that the @ is supposed to be before the bracket not inside.

For me it worked like this:

Excel Formula:
=MATCH(@[Fertilizer],Sheet1!C$5:C$12,0)+COUNTIF(INDEX([Fertilizer],1):@[Fertilizer],@[Fertilizer])/10^6

else I was getting a syntaxe error. The other way that worked was to add additional brackets that would wrap the @ such as:

Excel Formula:
=MATCH([@[Fertilizer]],Sheet1!C$5:C$12,0)+COUNTIF(INDEX([Fertilizer],1):[@[Fertilizer]],[@[Fertilizer]])/10^6
 
Upvote 0
Do the two tables (table 1 and table 3) need to be the size, row wise?
There isn't two tables as far as I am aware. You only ever showed one and I simply increased the number of columns in it.


After some fiddling it seem that the @ is supposed to be before the bracket not inside.
That is not so if the sheet is set up like mine.
You can have a look at a copy of my file here if you want to.
 
Upvote 0
There isn't two tables as far as I am aware. You only ever showed one and I simply increased the number of columns in it.
I meant the data in sheet 1. I called that a table, ok not an Excel table.

That is not so if the sheet is set up like mine.
You can have a look at a copy of my file here if you want to.
Yes, strange for me it said syntax error until I change the @ places. Thank you for the file.

Everything is working as you designed. One snag though. In the first Sheet a few of the fertilizers are on a different colum. Both lists start at the same row. Such as:

Book1.xlsx
CDEF
4Commercial fertilizerCommercial Traces
5Fertilizer 1Fertilizer 9
6Fertilizer 2Fertilizer 10
7Fertilizer 3Fertilizer 11
8Fertilizer 4
9Fertilizer 5
10Fertilizer 6
11Fertilizer 7
12Fertilizer 8
Sheet1


It's like that for visual purposes since that sheet is formated to look nice to the user. Can this be adapted to the formulas you provided above? I tried adding multiple ranges to the formula in the idx column but that didn't turn out so well.
 
Upvote 0
Could this work for you?

Make a combined list on Sheet1 like this (& hide the column if you want) and have the formulas that were referencing column C of Sheet1 point to column J instead.

Polanskiman_1.xlsm
CDEFGHIJ
4Commercial fertilizerCommercial TracesCombined List
5Fertilizer 1Fertilizer 9Fertilizer 1
6Fertilizer 2Fertilizer 10Fertilizer 2
7Fertilizer 3Fertilizer 11Fertilizer 3
8Fertilizer 4Fertilizer 4
9Fertilizer 5Fertilizer 5
10Fertilizer 6Fertilizer 6
11Fertilizer 7Fertilizer 7
12Fertilizer 8Fertilizer 8
13Fertilizer 9
14Fertilizer 10
15Fertilizer 11
16 
17 
18 
Sheet1
Cell Formulas
RangeFormula
J5:J18J5=IF(ROWS(J$5:J5)<=COUNTA(C$5:C$20),INDEX(C$5:C$20,ROWS(J$5:J5)),IF(ROWS(J$5:J5)<=COUNTA(C$5:C$20)+COUNTA(F$5:F$20),INDEX(F$5:F$20,ROWS(J$5:J5)-COUNTA(C$5:C$20)),""))
 
Upvote 0
Nice! Smart. This said I do not wish to have a hidden data table in that sheet as I like to have user sheets clean of any essential information. I'm a maniac! :whistle: This said, please let me know if what I did is ok. I basically used that formula and created a combined list in a separate sheet which is meant to be hidden. It's working fine but just thought I would ask if this could have any repercussions in the future.
 
Upvote 0
That sounds fine, or you could put it somewhere in the existing Sheet3 since that is already hidden & not for end users.
 
Upvote 0
That sounds fine, or you could put it somewhere in the existing Sheet3 since that is already hidden & not for end users.
Indeed. Could add it as a helper column. One bit that gets me curious though. In the index/match formula:
Excel Formula:
=IFERROR(INDEX(Table1[Description],MATCH(AGGREGATE(15,6,Table1[Idx],ROWS(A$1:A1)),Table1[Idx],0)),"")
the ROW function points to A$1:A1. What exactly does it mean? I ask because that range is blank in the example you provided.
 
Upvote 0
the ROW function points to A$1:A1
It is actually the ROWS function, not ROW.

It is counting rows & what is in the cells is irrelevant

So ROWS(A$1:A1) returns 1
When that formula is copied down to the next row it becomes
ROWS(A$1:A2) which returns 2
Copied down again it becomes
ROWS(A$1:A3) which returns 3
etc

It is providing an incremental value as the 4th argument of the AGGREGATE function so that function returns the smallest Idx number then the 2nd smallest Idx number, 3rd smallest etc
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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