Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Edit Array Funciton

I have an array. I fill it from a range of cells in excel. Once it is
filled with data, I want to change some of the data in a certain column
if certain conditions hold in the rows. I am assuming that a
ArrayColumnEditFuntion is the way to go. The InitialArray may look
like this:

1 2 3 4
1 10 40
2 8 25
3 0 30
4 2 15

Lets say that I want to zero out the 4th column numbers if the given
row value is 0 in column 1. Hence the revised array would look like:

1 2 3 4
1 10 40
2 8 25
3 0 0
4 2 15

The function would look something like:

ArrayColumnEditFunction(InitialArray, editcolumn, "0")

So I would say ArrayColumnEditFunction(InitialArray, 4, "0"). I guess
you coud always multiple column 1 value by column 4 value if the
element in the given row in column 1 was a 0.

Any thoughts on this?


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Edit Array Funciton

Sorry the website edited my matrix and it looks confusing. I
effectively had numbers in the first column and numbers in the fourth.
I left columns 2-3 empty for simplicity


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Edit Array Funciton

Sub ArrayColumnEditFunction(MyArray, col, vval)
for i = lbound(myarray,1) to ubound(myArray,1)
if myarray(i,lbound(myArray,2)) = val then
myarray(i,col) = vval
end if
Next
End Sub

what you pass in for vval would would depend on what is stored in the array,
but if the array holds numbers, pass in a zero, if letter, then pass in "0"

--
Regards,
Tom Ogilvy


"ExcelMonkey " wrote in message
...
I have an array. I fill it from a range of cells in excel. Once it is
filled with data, I want to change some of the data in a certain column
if certain conditions hold in the rows. I am assuming that a
ArrayColumnEditFuntion is the way to go. The InitialArray may look
like this:

1 2 3 4
1 10 40
2 8 25
3 0 30
4 2 15

Lets say that I want to zero out the 4th column numbers if the given
row value is 0 in column 1. Hence the revised array would look like:

1 2 3 4
1 10 40
2 8 25
3 0 0
4 2 15

The function would look something like:

ArrayColumnEditFunction(InitialArray, editcolumn, "0")

So I would say ArrayColumnEditFunction(InitialArray, 4, "0"). I guess
you coud always multiple column 1 value by column 4 value if the
element in the given row in column 1 was a 0.

Any thoughts on this?


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Edit Array Funciton

Thanks Tom


---
Message posted from http://www.ExcelForum.com/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with date funciton [email protected] Excel Worksheet Functions 3 May 1st 09 09:27 PM
Need help with nested funciton using vlookup mcmilja Excel Discussion (Misc queries) 6 June 19th 08 08:49 PM
We were wondering how to edit an array once it has been set up? Kfalcone Excel Worksheet Functions 3 December 14th 06 04:54 AM
Edit and Array JorgeAE Excel Worksheet Functions 1 April 21st 06 02:28 PM
RANK Funciton Marcos Excel Worksheet Functions 1 November 10th 05 12:34 AM


All times are GMT +1. The time now is 06:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"