A
A
Andrew2020-11-30 16:31:11
excel
Andrew, 2020-11-30 16:31:11

How to make cells auto-fill based on the number in a specific cell?

Hello!
Please tell me if it is possible to do it in Excel or Google Sheets or has someone come across such functionality:
The table has numbered columns from A to AG:
where A is a column with some names (they don’t really matter)
where B is a column with cells in which numbers are entered manually (up to 31).
The remaining columns are numbered from 1 to 31) ( screenshot )

When a certain number is indicated in column "B", in line "3" (let's say 20), then in line "3" columns from 1 to 31 should be autofilled (with any character) , BUT not completely, but only 20 random cells.

Another example:
If column "B", row "5" contains 10. Then in row "5" autocompletion (with any character) of columns from 1 to 31 should occur, BUT not completely, but only 10 random cells.

Spreadsheet
https://docs.google.com/spreadsheets/d/1ePmxK-W0U8...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2020-12-01
@AHgPeKa

For Google Sheets .

=array_constrain(ArrayFormula(ЕСЛИ(ТРАНСП(sort(ТРАНСП(ArrayFormula({RANDARRAY(1;31-B3)\1+RANDARRAY(1;B3);RANDARRAY(1;31)}));2;1))>=1;"!";""));1;31)

B3 - the number of required characters (in 2 places of the formula)
31 - total columns (in 3 places of the formula)
"!" - symbol (in 1 place of the formula)
"" - "empty" symbol (in 1 place of the formula)
ladder formula

=array_constrain(
  ArrayFormula(
    ЕСЛИ(
      ТРАНСП(sort(
        ТРАНСП(ArrayFormula(
          {RANDARRAY(1;31-B3)\1+RANDARRAY(1;B3);
           RANDARRAY(1;31)
          }
        ))
        ;2;1))>=1
    ;"!";"")
  )
;1;31)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question