Finding column number of "x" using a SPILL formula for each row

rizzo93

Active Member
Joined
Jan 22, 2015
Messages
303
Office Version
  1. 365
I want to find the column number of "x".

A
B
C
D
E
F
H
1
Plan
Department
1
2
3
4
6
2AlphaRed
x​
3BetaOrange
x​
4GammaBlue
x​
5OmegaGreen
x​
6ThetaYellow
x​
7PiPink
x​

Column B is a spill formula. To the right of column H, I want another spill formula to find which column the "x" is in for each row. I can do that in a non-spill way, but I want the formula to be dynamic so that it knows how many rows are involved based on what column B produces.

This is the formula I'm using:

Excel Formula:
=LET(r,ROWS(B2#),s,SEQUENCE(r),IF(s<=r,MATCH("x",C2:H2,0)))

While the results do spill, they only come up as "1" as a result, not the actual column number.

What am I missing please?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Your problem is that the formula only looks at C2:H2, it does not adapt for subsequent rows. Something like this:

Book3
ABCDEFGHI
1PlanDepartment123456Column
2AlphaRedx1
3BetaOrangex3
4GammaBluex3
5OmegaGreenx6
6ThetaYellowx1
7PiPinkx1
Sheet1
Cell Formulas
RangeFormula
B2:B7B2=A14:A19
I2:I7I2=IFERROR(INDEX(C1:H1,1/(1/MMULT(--(C2:INDEX(H:H,ROWS(B2#)+1)="x"),SEQUENCE(ROWS(B2#))))),"No x")
Dynamic array formulas.


This assumes at most 1 x per row. If you have the BYROW function, there may be better options.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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