Is there something like a map
function in Excel?
For example, let's say I want to apply the formula ABS
to a list of items. Something like:
=ABS,{-1,2,3,4,5}
As an example of python-like notation:
# list comprehension
>>> [abs(i) for i in [-1,2,3,4,5]]
[1, 2, 3, 4, 5]
# map
>>> map(abs,[-1,2,3,4,5])
[1, 2, 3, 4, 5]
# passing arbitrary function
>>> map(lambda x:abs(x) 1, [-1,2,4,5,6])
[2, 3, 5, 6, 7]
Is there something similar in Excel?
Note, the closest I've gotten is using native operators against lists, such as =2*{1,2,3,4,5}
, but this just gives things like the basic arithmetic operations.
CodePudding user response:
In Excel-365 you can directly use ABS()
function with array of data. Try-
=ABS({-1,2,3,4,5})
CodePudding user response: