Combine columns using dynamic array formula

sharshra

Active Member
Joined
Mar 20, 2013
Messages
404
Office Version
  1. 365
I have to combine 2 columns based on a criteria. At present, I´m able to do this using a simple IF statement. I would like to achieve the same result using dynamic array functions. The dynamic array formula used is returning incorrect results (refer trial table below). I know I would have done a silly mistake. Can the experts in this forum help please?

Problem statement -
In the source table, I have columns cl & ld with x marked in few cells. These 2 columns should be combined to a single column clld-c as shown in the desired output. If any cell in columns cl & ld in the source table contains x, mark x in the column clld-c in the desired output. If there is no x marked, leave it as blank cell. All other columns from source table remains the same.

Source table -
excel problems.xlsx
BCDEFGHI
2idnamedeptttt-clldclldttt-ceco
31fftyfxx
45ffdvhxx
59kgkgmx
611eqetxxx
720yuiofx
839lhlgfxx
967bmvvmx
1068bcvmx
1185ehvmxxx
1297okgtxxx
Sheet4


Trial table -
excel problems.xlsx
TUVWXYZAAABAC
31fftyfxx000#VALUE!x
45ffdvh000xxxx
59kgkgm00x00x#VALUE!
611eqet0x0xx#VALUE!x
720yuiof0000xxx
839lhlgf0xx00#VALUE!#VALUE!
967bmvvm00x00x#VALUE!
1068bcvm0000xxx
1185ehvmxxx00#VALUE!#VALUE!
1297okgt00xxxx#VALUE!
Sheet4
Cell Formulas
RangeFormula
T3:AC12T3=LET( fTable,$B$3:$I$12, fId,$B$3:$B$12,ClLd,$F$3:$G$12, comClLd,MAP(ClLd,LAMBDA(loopId,IF(OR(INDEX(ClLd,loopId,1)="x",INDEX(ClLd,loopId,2)="x"),"x",""))), HSTACK(fTable,comClLd))
Dynamic array formulas.


Desired output -
excel problems.xlsx
LMNOPQR
2idnamedeptttt-clldclld-cttt-ceco
31fftyfxx
45ffdvhxx
59kgkgmx
611eqetxxx
720yuiofx
839lhlgfx
967bmvvmx
1068bcvmx
1185ehvmxx
1297okgtxxx
Sheet4
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
How about
Excel Formula:
=LET(x,HSTACK(B3:E12,MAP(F3:F12,G3:G12,LAMBDA(a,b,IF(OR(a="x",b="x"),"x",""))),H3:I12),IF(x="","",x))
 
Upvote 1
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,802
Messages
6,181,054
Members
453,014
Latest member
Chris258

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