Embedding IF in single cell formula

sharshra

Active Member
Joined
Mar 20, 2013
Messages
404
Office Version
  1. 365
I have a formula working well, but is failing when I embed it in a single cell formula. Something is going wrong. Can the experts help please?

Table 1 has name, C & L values. Zone is derived from a reference table. The column 'both' will be populated if columns C & L are populated. I´m getting the correct values in 'both' column with the IF formula. I would like to write single cell formula to get the values for columns 'zone' & 'both'. Formula for 'zone' is working correctly. But, when I embed the formula for 'both', it is throwing error.

Table 1:
excel problems.xlsx
AEAFAGAHAI
2nameCLzoneboth
3ffafdsffafdsffafdsnorthffafds
4qewqqewqwest
5tyerytyerytyeryeasttyery
6ryutryutsouth
7hjghjghjgsouthhjg
8zvzvczvzvcwest
9vncvncnorth
10gsdggsdgeast
11fhdfhdfhdeastfhd
12fjggfjggfjggsouthfjgg
13lghllghlnorth
Sheet2
Cell Formulas
RangeFormula
AH3:AH13AH3=LET( n,$AE$3:$AE$13,c,$AF$3:$AF$13,l,$AG$3:$AG$13,nRef,$AP$3:$AP$13,zRef,$AQ$3:$AQ$13, z,MAP(n,LAMBDA(x,XLOOKUP(x,nRef,zRef))), both,MAP(n,LAMBDA(x,IF(LEN(c)*LEN(l)>0,n,""))), z)
AI3:AI13AI3=IF(LEN($AF$3:$AF$13)*LEN($AG$3:$AG$13)>0,$AE$3:$AE$13,"")
Dynamic array formulas.


Single cell formula for the derived values:
excel problems.xlsx
AK
3#CALC!
Sheet2
Cell Formulas
RangeFormula
AK3AK3=LET( n,$AE$3:$AE$13,c,$AF$3:$AF$13,l,$AG$3:$AG$13,nRef,$AP$3:$AP$13,zRef,$AQ$3:$AQ$13, z,MAP(n,LAMBDA(x,XLOOKUP(x,nRef,zRef))), both,MAP(n,LAMBDA(x,IF(LEN(c)*LEN(l)>0,n,""))), HSTACK(z,both))


Reference table:
excel problems.xlsx
APAQ
2namezone
3ffafdsnorth
4qewqwest
5tyeryeast
6ryutsouth
7hjgsouth
8zvzvcwest
9vncnorth
10gsdgeast
11fhdeast
12fjggsouth
13lghlnorth
Sheet2
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hello, why not just:

Excel Formula:
=LET(
n,$AE$3:$AE$13,c,$AF$3:$AF$13,l,$AG$3:$AG$13,nRef,$AP$3:$AP$13,zRef,$AQ$3:$AQ$13,
z,MAP(n,LAMBDA(x,XLOOKUP(x,nRef,zRef))),
both,IF(LEN(c)*LEN(l)>0,n,""),
HSTACK(z,both))
 
Upvote 1
Solution
Try:
Book2
AEAFAGAHAI
1
2nameCLzoneboth
3ffafdsffafdsffafdsnorthffafds
4qewqqewqwest
5tyerytyerytyeryeasttyery
6ryutryutsouth
7hjghjghjgsouthhjg
8zvzvczvzvcwest
9vncvncnorth
10gsdggsdgeast
11fhdfhdfhdeastfhd
12fjggfjggfjggsouthfjgg
13lghllghlnorth
Sheet1
Cell Formulas
RangeFormula
AH3:AI13AH3=LET(n,AE3:AE13,c,AF3:AF13,l,AG3:AG13,HSTACK(XLOOKUP(n,AP3:AP13,AQ3:AQ13),IF(LEN(c)*LEN(l)>0,n,"")))
Dynamic array formulas.
 
Upvote 1

Forum statistics

Threads
1,224,814
Messages
6,181,130
Members
453,021
Latest member
Justyna P

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