Reduce & Lambda functions value error

nmounir

Board Regular
Joined
Oct 16, 2020
Messages
107
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I have a text Nad45er67 where I want to extract the numbers from using reduce and Lambda functions. For some reason, I keep getting a Value Error. I am not sure what I am doing wrong here.
here is the formula I am using
=REDUCE(A2,SEQUENCE(LEN(A2)),LAMBDA(i,a,--CONCAT(IFERROR(--MID(i,a,1),""))))

1673709401273.png


your help is greatly appreciated
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
How about
Excel Formula:
=--(REDUCE("",SEQUENCE(LEN(A2)),LAMBDA(i,a,CONCAT(i,IFERROR(--MID(A2,a,1),"")))))
 
Upvote 0
How about
Excel Formula:
=--(REDUCE("",SEQUENCE(LEN(A2)),LAMBDA(i,a,CONCAT(i,IFERROR(--MID(A2,a,1),"")))))
Thank you Fluff, it works very well. However, I can't include A3 and A4 to let the formula spill. I am still getting a Value error.

1673712692744.png
 
Upvote 0
How about
Excel Formula:
=LAMBDA(txt,--(DROP(REDUCE("",txt,LAMBDA(i,a,VSTACK(i,CONCAT(IFERROR(--MID(a,SEQUENCE(LEN(a)),1),""))))),1)))(A2:A3)
 
Upvote 0
Solution
How about
Excel Formula:
=LAMBDA(txt,--(DROP(REDUCE("",txt,LAMBDA(i,a,VSTACK(i,CONCAT(IFERROR(--MID(a,SEQUENCE(LEN(a)),1),""))))),1)))(A2:A3)
It works perfectly. Thank you very much Fluff.
i am just wondering why my formula never worked? any idea? maybe I am not fully understanding the reduce function very well.
 
Upvote 0
The main problem with your formula is that you were trying to pass an array to sequence which does not work.
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,053
Members
449,206
Latest member
Healthydogs

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