Module 13 · Dynamic Arrays · Price and stock in one formula

Nadia Rahman runs Inkwell Books and loves data

During book week, the phone rings all day. Customers ask for a price, and then: do you have it? Nadia wants price and stock with one formula. Then she can fill whole orders fast.

Loading the spreadsheet…

Module 13 · Dynamic Arrays

Price and stock in one formula

Nadia Rahman, runs Inkwell Books and loves data
Nadia Rahman runs Inkwell Books and loves data

During book week, the phone rings all day. Customers ask for a price, and then: do you have it? Nadia wants price and stock with one formula. Then she can fill whole orders fast.

Steps

  1. Return two columns

    XLOOKUP can return more than one column. Use a return range with two columns, for example D5:E16. The result spills to the right.

    How to do it

    1. Click cell H5.
    2. Type =XLOOKUP( with the value to find, the range to search and a comma.
    3. Type a return range with two columns and a closing bracket.
    4. Press Enter.

    =XLOOKUP(G5,B5:B16,D5:E16)

    Task: The next customer wants Moss and Iron. Put its price and stock in H6 and I6 with one formula in H6.

  2. Fill the formula down

    To use the formula for more rows, fill it down. Lock the ranges with $, for example $B$5:$B$16. Then they do not move.

    How to do it

    1. Click cell H10.
    2. Type the formula. Put $ in front of the column and the row of each range.
    3. Press Enter.
    4. Select the cell with the formula.
    5. Drag the fill handle down over the other rows.
    6. Press F4 (Mac: fn+F4) while you type a range to add the $ signs.

    =XLOOKUP(G10,$B$5:$B$16,$D$5:$E$16)

    Task: Fill in the library order. Type one formula in H16 and fill it down to H18.