Questions tagged [array]

245 questions
29
votes
2 answers

How to count the number of elements in an array in Ansible?

An array is generated in Ansible from shell command output, it is similar to below: foo: [value0, value1, value2, value3] Now depending on output of the shell command, the number of elements of foo may vary. I then generate a jinja2 template to…
frenchy59
  • 393
25
votes
6 answers

Test if element is in array in bash

Is there a nice way of checking if an array has an element in bash (better than looping through)? Alternatively, is there another way to check if a number or string equals any of a set of predefined constants?
Tgr
  • 3,133
8
votes
3 answers

How do I merge an array of images into a single giant image?

I have 220 png images of equal height and width with the following naming convention: A1.png, A2.png, ... V9.png, V10.png I need to merge them into one giant image, with A1 being the top left corner, letters increasing horizontally and numbers…
SubTea
  • 81
7
votes
2 answers

Extract values from a range that are missing from another

I've got two columns in Excel, "ROSTER" and "PRESENT", shown below: Is there a formula to achieve the "NOT HERE" column? I tried using VLOOKUP() and https://superuser.com/a/289653/135912 to no avail =( Any help would be appreciated! Thanks!
Kevin Hua
  • 300
6
votes
2 answers

Use functions like Countif, Countblank etc. to refer to discontiguous ranges.

Is there a way to use array formulas or some other feature to essentially have an excel function that means. =Countblank({A1,A4:A6,A112:127,B29:B38}) etc. Essentially, I want to refer to multiple locations where you would normally type a…
6
votes
3 answers

Spawning multiple parallel wgets and storing results in a bash array to be pretty printed when all wgets are done

I have a long list of urls on my own website listed in a carriage return seperated text file. So for instance: http:/www.mysite.com/url1.html http:/www.mysite.com/url2.html http:/www.mysite.com/url3.html I need to spawn a number of parallel wgets…
Brad
  • 195
6
votes
1 answer

Is there a good way to write a shell script compatible with both bash and zsh that addresses array elements?

The fact that bash is 0-indexed and zsh is 1-indexed can cause problems. For example the following will work as intended with bash, but not zsh (PS I am aware that I don't NEED to use an array for this, it's just an…
Stonecraft
  • 360
  • 5
  • 15
6
votes
4 answers

Excel INDEX MATCH Checking Multiple Columns

The problem I'm essentially trying to solve is a VLOOKUP that is checking Columns A:E for a value, and returning the value held in Column F should it be found in any of these. With VLOOKUP not being up to the task I have looked into the INDEX-MATCH…
5
votes
1 answer

ZSH iterate through string array containing spaces

I am trying to write a ZSH script which will iterate through a series of strings that contain spaces. First, I'll set -A the array: set -A a "this is" "a test" "of the" "emergency broadcast system" From here, I'll try to iterate through it using a…
4
votes
2 answers

List values based on criteria

I have a table on a worksheet called "DealSetup" that looks like this simplified version: A B 1 John Doe 1 2 Jane Doe 1 3 Mark Doe 2 4 Doug Doe 1 5 Mary Doe 2 I have a table on a worksheet called "List" that I would…
4
votes
3 answers

MS Excel: Sumproduct only visible rows (use sumproduct with subtotal(9,array))

Pretty straightforward. I want to use a SUMPRODUCT but only for visible rows. I've tried =SUMPRODUCT(A2:A10, SUBTOTAL(9,B2:B10)) ... didn't work, even as an array formula. I'm probably missing something obvious but ... why doesn't this work? How can…
user45867
  • 165
4
votes
1 answer

How to map one array element which is separated by newlines into a new array with multiple elements

I select 4 files in Nemo in the path /home/myUsername/.local/share/nemo/scripts/Folder with spaces/. Nemo stores the file paths in the environment variable NEMO_SCRIPT_SELECTED_FILE_PATHS. (As you can see in the answer from glenn jackman below,…
3
votes
1 answer

Make an array formula in excel calculate only on active rows

When excel calculates formulas over a column (e.g. a lookup), it's smart enough to only calculate until the last active row, rather than also running on all the blank rows. With array formulas, it seems this behaviour changes, and it calculates over…
3
votes
2 answers

How to highlight boundaries of an array in Excel?

I'd like to know if there's a way to make excel show me where are the boundaries of an array, like the highlight I made in the picture below. Some explanation: I have a worksheet that is full of arrays everywhere, and sometimes I have to insert a…
GabrielF
  • 143
  • 5
3
votes
2 answers

Excel, how to use text functions on lookup array without putting in another column?

If I'm using a vlookup, or a match function but I need to do some mumbo jumbo on my lookup material, is there a way of doing this in the lookup array without simply adding another column? Let's say I have a lookup value of "FOOBAR 123" and I want to…
1
2 3
16 17