简体   繁体   中英

How can I fill an Excel array without using VBA?

I have data in the format (Observed value, Number of observations) and would like to convert it to an array of values. For example, if I had (Value = 12, Number of observations = 3), I would like to use built-in formulas to create 3 cells each containing the number 12. Is this possible? This is an example of what I'm trying to do. Thanks!

If you're willing to accept empty string instead of blank then, assuming your first column of inputs are in A1:A2 , fill your output range for column A starting from A4 with:

=IF(ROW()-ROW(A$4)<A$2,A$1,"")

You can avoid the reference to the top cell by using:

=IF(ROW()-MIN(ROW())<A$2,A$1,"")

Make it an array formula ( Ctrl + Shift + Enter ) in the output range of column A.

You can copy either of these to the right to support additional columns.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM