return row and column headers for matrix for duplicate values

DeonRobbie

New Member
Joined
Oct 8, 2021
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
Hi all
I am busting my head for past few days in getting the formulas to work. I have a building condition survey spreadsheet where the physical condition of different items in different rooms get evaluated. Each item in each room receive a value from 0 to 3. 0=good and 3 = severe / critical.
The matrix is 17 rows by 12 columns, with items inspected in the first column, and rooms inspected in the first row.I need a method to find all cells with condition 3 to return the corresponding column header and row. Any possible suggestions?


1633694320633.png

Regards DeonRobbie
 
the equations above are the closest I`ve seen.
Are you saying that the latest formulas still do not work?
If so, could you please provide a sample of the table shown in post 1 with XL2BB so that we can see the formulas and copy the values that you actually have rather than the ones that we might make up for ourselves?
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
.. but perhaps contains a formula returning "" so is not in fact blank?
Try these instead
P2 copied down:
Excel Formula:
=IFERROR(INDEX(A$2:A$19,AGGREGATE(15,6,(ROW(A$2:A$19)-ROW(A$2)+1)/(C$2:N$19<>"")/(C$2:N$19<>0),ROWS(P$2:P2))),"")

Q2 copied down:
Excel Formula:
=IFERROR(INDEX(C$1:N$1,AGGREGATE(15,6,(COLUMN(C$1:N$1)-COLUMN(C$1)+1)/(A$2:A$19=P2)/(C$2:N$19<>"")/(C$2:N$19<>0),COUNTIFS(P$2:P2,P2))),"")

(Picture removed)

Hi Peter,
Sorry for the delay. The Array I1:O13 has no equations on it.
 
Last edited by a moderator:
Upvote 0
You are correct in that it`s reading from a dynamically calculated matrix.

The Array I1:O13 has no equations on it.
Those two statements seem to contradict each other.

In any case, we cannot tell much from a picture. Can you give us that information shown in post #12 with XL2BB instead of an image? Then we can test with the same data that you are testing with and might be able to work out what is happening.
 
Upvote 0
Those two statements seem to contradict each other.

In any case, we cannot tell much from a picture. Can you give us that information shown in post #12 with XL2BB instead of an image? Then we can test with the same data that you are testing with and might be able to work out what is happening.
Hi Peter, mini sheet below. The picture above was created an example file with made up data and no equations to troubleshoot this one. The operational file does have equations in the range. The equations being attempted here don`t work in either case.
 
Upvote 0
Those two statements seem to contradict each other.

In any case, we cannot tell much from a picture. Can you give us that information shown in post #12 with XL2BB instead of an image? Then we can test with the same data that you are testing with and might be able to work out what is happening.
Hi Peter, lets use this as our example. We have a static array, and an example of using these equations to look for a specific result, 25 in this case, and an example of using <>"" or <>0 (same results using either criteria).

book1.xlsm
ABCDEFGHIJKLMNO
1`= a specific integer (25)`= <>0 and/or <>""#ABCDEF
21A1A1A1A1
31E1E1A1A1
4   1A1A1
5   1B1B1
6   1B1B1
7   1C1C1
8   1C1C1
9   1C1C1
10   1C1C125125.15127.5
11   1C1C110
12   1D1D10.2525
13   1D1D10.415
14   1D1D
Sheet1
Cell Formulas
RangeFormula
A2A2=IFERROR(INDEX($I$2:$I$13,AGGREGATE(15,6,(ROW($I$2:$I$13)-ROW($I$2)+1)/($J$2:$O$13=25),ROWS(A2:A$2))),"")
B2B2=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=A2)/($J$2:$O$13=25),COUNTIFS(A2:A$2,A2))),"")
G2:G14,C2:C14C2=A2&B2
A3:A14A3=IFERROR(INDEX($I$2:$I$13,AGGREGATE(15,6,(ROW($I$2:$I$13)-ROW($I$2)+1)/($J$2:$O$13=25),ROWS(A$2:A3))),"")
B3:B14B3=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=A3)/($J$2:$O$13=25),COUNTIFS(A$2:A3,A3))),"")
E2E2=IFERROR(INDEX($I$2:$I$13,AGGREGATE(15,6,(ROW($I$2:$I$13)-ROW($I$2)+1)/($J$2:$O$13<>0),ROWS(E2:E$2))),"")
F2F2=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=E2)/($J$2:$O$13<>0),COUNTIFS(E2:E$2,E2))),"")
E3:E14E3=IFERROR(INDEX($I$2:$I$13,AGGREGATE(15,6,(ROW($I$2:$I$13)-ROW($I$2)+1)/($J$2:$O$13<>0),ROWS(E$2:E3))),"")
F3:F14F3=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=E3)/($J$2:$O$13<>0),COUNTIFS(E$2:E3,E3))),"")
 
Last edited by a moderator:
Upvote 0
Firstly, most of those "empty" cells in J2:O13 are not empty but contain zero values, presumably hidden by Custom cell formatting or Conditional Formatting. The only ones that appear empty and do not contain zero are J2:O2 and J7:O7

Secondly, I think that the cells J2:O2 and J7:O7 probably previously had formulas that resulted in "" in them and those cells (probably along with the rest in that grid) have had a Copy/Paste Values applied to them. That would mean those cells actually contain a null string and are thus also not really empty.

Anyway, see how this goes.

23 12 10.xlsm
EFGHIJKLMNO
1`= <>0 and <>""#ABCDEF
21A1A1
31C1C1000000
41C1C1000000
51C1C1000000
61D1D1000000
71D1D1
81E1E1000000
91E1E1000000
10   1250125.15127.500
11   10010000
12   10000.25250
13   1000.40150
List
Cell Formulas
RangeFormula
E2E2=IFERROR(INDEX(I$2:I$13,AGGREGATE(15,6,(ROW(I$2:I$13)-ROW(I$2)+1)/((J$2:O$13<>0)*(J$2:O$13<>"")),ROWS(E2:E$2))),"")
F2F2=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=E2)/((J$2:O$13<>0)*(J$2:O$13<>"")),COUNTIFS(E2:E$2,E2))),"")
G2:G13G2=E2&F2
E3:E13E3=IFERROR(INDEX(I$2:I$13,AGGREGATE(15,6,(ROW(I$2:I$13)-ROW(I$2)+1)/((J$2:O$13<>0)*(J$2:O$13<>"")),ROWS(E$2:E3))),"")
F3:F13F3=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=E3)/((J$2:O$13<>0)*(J$2:O$13<>"")),COUNTIFS(E$2:E3,E3))),"")
 
Upvote 0
Firstly, most of those "empty" cells in J2:O13 are not empty but contain zero values, presumably hidden by Custom cell formatting or Conditional Formatting. The only ones that appear empty and do not contain zero are J2:O2 and J7:O7

Secondly, I think that the cells J2:O2 and J7:O7 probably previously had formulas that resulted in "" in them and those cells (probably along with the rest in that grid) have had a Copy/Paste Values applied to them. That would mean those cells actually contain a null string and are thus also not really empty.

Anyway, see how this goes.

23 12 10.xlsm
EFGHIJKLMNO
1`= <>0 and <>""#ABCDEF
21A1A1
31C1C1000000
41C1C1000000
51C1C1000000
61D1D1000000
71D1D1
81E1E1000000
91E1E1000000
10   1250125.15127.500
11   10010000
12   10000.25250
13   1000.40150
List
Cell Formulas
RangeFormula
E2E2=IFERROR(INDEX(I$2:I$13,AGGREGATE(15,6,(ROW(I$2:I$13)-ROW(I$2)+1)/((J$2:O$13<>0)*(J$2:O$13<>"")),ROWS(E2:E$2))),"")
F2F2=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=E2)/((J$2:O$13<>0)*(J$2:O$13<>"")),COUNTIFS(E2:E$2,E2))),"")
G2:G13G2=E2&F2
E3:E13E3=IFERROR(INDEX(I$2:I$13,AGGREGATE(15,6,(ROW(I$2:I$13)-ROW(I$2)+1)/((J$2:O$13<>0)*(J$2:O$13<>"")),ROWS(E$2:E3))),"")
F3:F13F3=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=E3)/((J$2:O$13<>0)*(J$2:O$13<>"")),COUNTIFS(E$2:E3,E3))),"")
Peter, that's it! Outstanding, thank you so much. I feel greedy for asking this, but is it also possible to combine these two equations into one formula such that in a single column I get to the combined number/letter results in column G? Or is that off the table.
 
Upvote 0
Peter, that's it! Outstanding, thank you so much.
You're welcome, but I had a slight error in the row 2 formulas of my previous post. Formulas should have been these. You may already have made the correction.

23 12 10.xlsm
EFGHIJKLMNO
1`= <>0 and <>""#ABCDEF
21A1A1
31C1C1000000
41C1C1000000
51C1C1000000
61D1D1000000
71D1D1
81E1E1000000
91E1E1000000
10   1250125.15127.500
11   10010000
12   10000.25250
13   1000.40150
List
Cell Formulas
RangeFormula
E2:E13E2=IFERROR(INDEX(I$2:I$13,AGGREGATE(15,6,(ROW(I$2:I$13)-ROW(I$2)+1)/((J$2:O$13<>0)*(J$2:O$13<>"")),ROWS(E$2:E2))),"")
F2:F13F2=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=E2)/((J$2:O$13<>0)*(J$2:O$13<>"")),COUNTIFS(E$2:E2,E2))),"")
G2:G13G2=E2&F2



is it also possible to combine these two equations into one formula such that in a single column I get to the combined number/letter results in column G?
I am unsure. I believe that your column I sample data above is not at all representative of your real data. If I am right, could we have some more realistic sample data (it can still be dummy data but more like the structure of your real data) and the expected results with XL2BB?
 
Upvote 0
You're welcome, but I had a slight error in the row 2 formulas of my previous post. Formulas should have been these. You may already have made the correction.

23 12 10.xlsm
EFGHIJKLMNO
1`= <>0 and <>""#ABCDEF
21A1A1
31C1C1000000
41C1C1000000
51C1C1000000
61D1D1000000
71D1D1
81E1E1000000
91E1E1000000
10   1250125.15127.500
11   10010000
12   10000.25250
13   1000.40150
List
Cell Formulas
RangeFormula
E2:E13E2=IFERROR(INDEX(I$2:I$13,AGGREGATE(15,6,(ROW(I$2:I$13)-ROW(I$2)+1)/((J$2:O$13<>0)*(J$2:O$13<>"")),ROWS(E$2:E2))),"")
F2:F13F2=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$13=E2)/((J$2:O$13<>0)*(J$2:O$13<>"")),COUNTIFS(E$2:E2,E2))),"")
G2:G13G2=E2&F2




I am unsure. I believe that your column I sample data above is not at all representative of your real data. If I am right, could we have some more realistic sample data (it can still be dummy data but more like the structure of your real data) and the expected results with XL2BB?
Hi Peter, do you mean for the COUNTIFS ABS reference? Yes I caught that, equations are working as expected. And yes, the column I data was a bit of a typo, it should look like the following. This time I have also left the strings you referenced above in place so we can see if they will ever cause issue. Thus far your solution handles them.


book1.xlsm
EFGHIJKLMNO
1RowColumnMatrix#ABCDEF
29A9A1
39C9C2000000
49D9D3000000
510C10C4000000
611D11D5000000
711E11E6
812C12C7000000
912E12E8000000
1013C13C9250125.15127.500
1113D13D100010000
1213E13E110000.25250
13   12000.40150
14   1300-80.0250.25100
Sheet1
Cell Formulas
RangeFormula
E2:E14E2=IFERROR(INDEX(I$2:I$14,AGGREGATE(15,6,(ROW(I$2:I$14)-ROW(I$2)+1)/((J$2:O$14<>0)*(J$2:O$14<>"")),ROWS(E$2:E2))),"")
F2:F14F2=IFERROR(INDEX($J$1:$O$1,AGGREGATE(15,6,(COLUMN($J$1:$O$1)-COLUMN($J$1)+1)/($I$2:$I$14=E2)/(($J$2:$O$14<>0)*($J$2:$O$14<>"")),COUNTIFS(E$2:E2,E2))),"")
G2:G14G2=E2&F2
 
Last edited by a moderator:
Upvote 0
Hi Peter, do you mean for the COUNTIFS ABS reference?
Yes, and similar in the ROWS() function at the end of the col E formula. Glad you caught them both.


the column I data was a bit of a typo, it should look like the following.
:confused: Should it? The data that you requested be removed from the forum was not simple numerical values in col I but rather a combination of letters, numbers and dashes of varying lengths.
Can you clarify what the actual position is (& make up some more realistic dummy sample data if it is not simply numbers in col I?
If they are just numbers in column I, are they a simple sequence of consecutive numbers as shown above?
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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