schardt679
Board Regular
- Joined
- Mar 27, 2021
- Messages
- 58
- Office Version
- 365
- 2010
- Platform
- Windows
- Mobile
- Web
AVALUE converts yes's/TRUE's to 1's, no's/FALSE's to 0's, empty cells to a value, errors to a value, numbers stored as text to numbers, and leaves text alone.
Optional arguments require comma to work. AVALUE is an improved version of NUMTEXT.
Optional arguments require comma to work. AVALUE is an improved version of NUMTEXT.
Excel Formula:
=LAMBDA(Array,Convert_YesNo,Empty_Value,Error_Value,
LET(E, "",
Arr, Array&E,
ConYN?, Convert_YesNo,
Empty, Empty_Value&E,
Error, Error_Value&E,
ConScan, AND(ConYN?<>{1,0}),
ConMSG, "Convert=1,0",
Error?,IFERROR(Arr, SWITCH(Error, E, E, "#Error", Arr, Error)),
Empty?, IF(Error?=E, Empty, Error?),
YesNo?, IF(ConYN?, SWITCH(Empty?, "YES", 1, "NO", 0, Empty?), Empty?),
TrueFalse?, SWITCH(YesNo?, "TRUE", 1, "FALSE", 0, YesNo?),
Result, IFERROR(--(TrueFalse?), TrueFalse?),
Return, IF(ConScan, ConMSG, Result),
Return
)
)
LAMBDA Examples.xlsx | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
1 | AVALUE | ||||||||
2 | |||||||||
3 | Original Data | Result | |||||||
4 | Quesition | Response | Quesition | Response | |||||
5 | What is your name? | Patrick Schardt | What is your name? | Patrick Schardt | |||||
6 | Did you go to college? | Yes | Did you go to college? | Yes | |||||
7 | Did you dorm? | No | Did you dorm? | No | |||||
8 | Did you live in an on/off campus apartment? | No | Did you live in an on/off campus apartment? | No | |||||
9 | That means you were a commuter, right? | That means you were a commuter, right? | No Data | ||||||
10 | Did you graduate? | Yes | Did you graduate? | Yes | |||||
11 | When? | 2017 | When? | 2017 | |||||
12 | How many degrees do you have? | 3 | How many degrees do you have? | 3 | |||||
13 | What are they? | Mechatronics BS, Computer Engineering AS, & Robotics AS | What are they? | Mechatronics BS, Computer Engineering AS, & Robotics AS | |||||
14 | Were any 1st run majors? | #N/A | Were any 1st run majors? | No Data | |||||
15 | |||||||||
16 | Yes's & No's are not converted | ||||||||
17 | Empty Cells are converted to "No Data" | ||||||||
18 | Errors are converted to the empty cell value | ||||||||
19 | Formula in cell E4☛ =AVALUE(B4:C14,, "No Data",) | ||||||||
20 | |||||||||
21 | |||||||||
22 | |||||||||
23 | Original Data | Result | |||||||
24 | Product | Ordered? | Ordered? | Total Orders | |||||
25 | Pepper Deseeder | Yes | 1 | 4 | |||||
26 | Knife Set | No | 0 | ||||||
27 | Cutting Board | YES | 1 | ||||||
28 | Peeler | ||||||||
29 | Spatula | NO | 0 | ||||||
30 | Meat Tenderizer | TRUE | 1 | ||||||
31 | Cast Iron 5-piece Set | 1 | 1 | ||||||
32 | Serving Platter | FALSE | 0 | ||||||
33 | Dinnerware 16-piece Set | #N/A | 0 | ||||||
34 | |||||||||
35 | Yes's & No's are converted to 1's & 0's | ||||||||
36 | Empty cells are returned | ||||||||
37 | Errors are converted to 0 | ||||||||
38 | Formula in cell E25☛ =AVALUE(C25:C33, 1,, 0) | ||||||||
39 | |||||||||
40 | |||||||||
41 | |||||||||
42 | Original Data | Result | |||||||
43 | Date | Date | |||||||
44 | 3/22/2021 | 03/22/21 | |||||||
45 | #VALUE! | #VALUE! | |||||||
46 | 3/22/2021 | 03/22/21 | |||||||
47 | 03/23/21 | 03/23/21 | |||||||
48 | |||||||||
49 | #REF! | #REF! | |||||||
50 | 03/24/21 | 03/24/21 | |||||||
51 | |||||||||
52 | Yes's & No's aren't converted | ||||||||
53 | Empty cells are returned | ||||||||
54 | Errors are returned | ||||||||
55 | Formula in cell D43☛ =AVALUE(B43:B50,,, "#Error") | ||||||||
56 | |||||||||
AVALUE |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E4:F14 | E4 | =AVALUE(B4:C14,, "No Data",) |
C14,C33 | C14 | =NA() |
B19 | B19 | =AFORMULATEXT(E4) |
E25:E33 | E25 | =AVALUE(C25:C33, 1,, 0) |
F25 | F25 | =SUM(E25#) |
B38 | B38 | =AFORMULATEXT(E25) |
D43:D50 | D43 | =AVALUE(B43:B50,,, "#Error") |
B55 | B55 | =AFORMULATEXT(D43) |
Dynamic array formulas. |
Upvote
0