简体   繁体   English

使用公式根据单元格值插入行

[英]Insert rows based on cell value using formula

How to insert rows with random data based on a cell value. 如何根据单元格值插入包含随机数据的行。 Example: If A1 cell is having=4, it should insert 4 rows in Name, Age(random value) columns 示例:如果A1单元格具有= 4,则应在“名称”,“年龄”(随机值)列中插入4行

I want to do it using formulas not by macro 我想使用公式而不是通过宏

Lets say D1 is the header name and E1 is the header age 假设D1是标题名称,E1是标题年龄

Enter on D2 For name: 在D2输入名称:

=IF($A$1>=ROW(D1),CHAR(RANDBETWEEN(65,90)),"")

and on E2 for age: 以及E2年龄:

=IF($A$1>=ROW(D1),RANDBETWEEN(1,120),"")

You can drag both formulas to the max amount of numbers you desire. 您可以将两个公式都拖动到所需的最大数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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