开发者

Need help going thru a list of arrays and outputing

开发者 https://www.devze.com 2023-03-21 00:33 出处:网络
hi guys I need help on coding this for work 1 2 3 4 5 6 7 8 9 10 y n y y y n y n yy n y n y n y n y yn y n y y y y n y ny

hi guys I need help on coding this for work

1 2 3 4 5 6 7 8 9 10                            
y n y y y n y n y  y          
n y n y n y n y y  n             
y n y y y y n y n  y 

I have this data in excel and I want to iterate through these data row by row and output the top integer without skipping cells of the cells that has a n in it

so the output would be somethign like this

1 2 3 4 5 6 7 8 9 10                           开发者_Python百科 
y n y y y n y n y  y   2 6 8            
n y n y n y n y y  n   1 3 5 7 10     
y n y y y y n y n  y   2 7 9

I'm a nub to using excel macro and would really be thankful if someone could help me out wit this problem to save some time.


From

1 2 3 4 5 6 7 8 9 10
y n y y y n y n y y
n y n y n y n y y n
y n y y y y n y n y 

you can produce a second sheet, where you convert/translate n to 1 and y to 0:

1 2 3 4 5 6 7 8 9 10
0 1 0 0 0 1 0 1 0 0
1 0 1 0 1 0 1 0 0 1
0 1 0 0 0 0 1 0 1 0 

Then you can produce a third sheet, where you multiply the cell from the former sheet with the column header, which gives:

1 2 3 4 5 6 7 8 9 10
0 2 0 0 0 6 0 8 0 0
1 0 3 0 5 0 7 0 0 10
0 2 0 0 0 0 7 0 9 0 

Hiding Nulls should be an Option too, so you would end with

1 2 3 4 5 6 7 8 9 1 
  2       6   8    
1   3   5   7     1 
  2         7   9   

Is this enough, or do you need to glue the result together?

1 2 3 4 5 6 7 8 9 1 Glueing
  2       6   8     2 6 8
1   3   5   7     1 1 3 5 7 
  2         7   9   2 7 9 

There are string concatenation functions, but can/must the result be glued together in a single field, or do you need one field per value? However, if the glueing brings the Zeros back, you can suppress them with 'if ...'.

You catenate togeter on a new sheet: In A2 A2', where ' marks the previous sheet. And in A3, A4, A5 and so on A3', A4', A5 and so on, but on B2 you catenate A2+B2' - the field to the left and the field from the previous sheet.

And this cell cat (A2; Table4.A3) you can pull to the bottom and to the right, and it will step by step glue together the whole expression.

You can link the result to the first page back.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号