Arrary If formula not giving expected result

mcfclax

New Member
Joined
Aug 23, 2013
Messages
10
Hi

I have a sheet which shows the training needs of a team of people. I want to be able to use a formaula that will show who has an "I" against each skill. So against Offshore Cash it would read "Person 4 Person 5 Person 6"

The formula I have used for this is
Code:
{=IF(B2:B9="I",A2:A9,"None")}
And it gives the result of none.

If I put an "I" against person 1 the result changes to "Person 1"

Any thoughts where this is going wrong?
Offshore Cash
Offshore Assets
Offshore Futures
Offshore Sup Tasks
Onshore Cash
Onshore Assets
Onshore Sup Tasks
Person 1
I
I
Person 2
I
I
Person 3
L
I
I
O
O
Person 4
I
I
I
O
C
Person 5
I
I
I
L
I
Person 6
I
I
I
I
C
L
O
Person 7
O
I
I
I
Person 8
O
O

<tbody>
</tbody>
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Assuming your data in A1:H9 try


J
1
List​
2
Person 4​
3
Person 5​
4
Person 6​

Array formula in J2
=IFERROR(INDEX(A:A,SMALL(IF($B$2:$B$9="I",ROW($A$2:$A$9)),ROWS(J$2:J2))),"")

confirmed with Ctrl+Shift+Enter

copy down

M.
 
Upvote 0
Thanks Marcelo Branco

That sort of works. It does give the correct people in a list going down in column J. Is is possible to have this as a combined list, with one name after the other all in the same cell (J2)?
 
Upvote 0
To put all values in the same cell you need VBA.

Paste the UDF (User Defined Function) below on a Standard Module

Code:
Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
    Dim y As Variant
    If TypeOf a Is Range Then
        For Each y In a.Cells
            aconcat = aconcat & y.Value & sep
        Next y
    ElseIf IsArray(a) Then
        For Each y In a
            aconcat = aconcat & y & sep
        Next y
    Else
        aconcat = aconcat & a & sep
    End If
    aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function

Copy (Ctrl+C) the code
Alt+F11 to open the VBEditor
Insert > Module
Paste (Ctrl+V) on the right panel

back to Excel


J
1
List​
2
Person 4,Person 5,Person 6​

<tbody>
</tbody>


Array formula in J2
=SUBSTITUTE(aconcat(IF($B$2:$B$9="I",","&$A$2:$A$9,"")),",","",1)

confirmed with Ctrl+Shift+Enter

Hope this helps

M.
 
Upvote 0
Thanks very much Marcelo. It was clearly way more complicated than I thought it would be.

I've done a little bit of VBA before but I have no idea what any of that code means.

However it does work a treat so thanks very much for all your help.
 
Upvote 0
Thanks very much Marcelo. It was clearly way more complicated than I thought it would be.

I've done a little bit of VBA before but I have no idea what any of that code means.

However it does work a treat so thanks very much for all your help.

You are welcome. Glad for helping.

M.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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