ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Conditional placement of an item (https://www.excelbanter.com/excel-worksheet-functions/156671-conditional-placement-item.html)

DA_Potts

Conditional placement of an item
 
I want to use/create a function whereby if a value is equal to one number the
data i enter will go into one of a series of cells
example - if the value is 123 then the value of cell d3=125, if the vale is
124 the value of cell e3=125, if the value is 177 then the value of cell
ah3=125. Any suggestions?

Gary''s Student

Conditional placement of an item
 
Function putval(i As Integer) As Variant
putval = ""
ad = Application.Caller.Address
If i = 123 And ad = "$D$3" Then putval = 125
If i = 124 And ad = "$E$3" Then putval = 125
If i = 177 And ad = "$AH$3" Then putval = 125
End Function

So put =putval(A1) in D3 and E3 and AH3
Then set A1 accordingly.
--
Gary''s Student - gsnu200741


"DA_Potts" wrote:

I want to use/create a function whereby if a value is equal to one number the
data i enter will go into one of a series of cells
example - if the value is 123 then the value of cell d3=125, if the vale is
124 the value of cell e3=125, if the value is 177 then the value of cell
ah3=125. Any suggestions?


roadkill

Conditional placement of an item
 
Depending on how many different cells you may need to populate based on how
many values, another approach would be to put "if" formulas in the sells
where you want values to appear.

eg. if your "value" is in a3, then in cell d3 you could put
'=if(a3=123,125,"")'
similar formulas would go into e3 and ah3.
Will

"DA_Potts" wrote:

I want to use/create a function whereby if a value is equal to one number the
data i enter will go into one of a series of cells
example - if the value is 123 then the value of cell d3=125, if the vale is
124 the value of cell e3=125, if the value is 177 then the value of cell
ah3=125. Any suggestions?


DA_Potts[_2_]

Conditional placement of an item
 
Thank you. This is an interesting start, however I may need to do some sort
of nesting as I actually have about 4500 options that would have to be
represented. I'm sorry I wasn't more specific in my original question

"Gary''s Student" wrote:

Function putval(i As Integer) As Variant
putval = ""
ad = Application.Caller.Address
If i = 123 And ad = "$D$3" Then putval = 125
If i = 124 And ad = "$E$3" Then putval = 125
If i = 177 And ad = "$AH$3" Then putval = 125
End Function

So put =putval(A1) in D3 and E3 and AH3
Then set A1 accordingly.
--
Gary''s Student - gsnu200741


"DA_Potts" wrote:

I want to use/create a function whereby if a value is equal to one number the
data i enter will go into one of a series of cells
example - if the value is 123 then the value of cell d3=125, if the vale is
124 the value of cell e3=125, if the value is 177 then the value of cell
ah3=125. Any suggestions?


DA_Potts[_2_]

Conditional placement of an item
 
Thanks for the idea. It creates two distinct problems. First it can't erase
data that is already stored in a cell, if there is some, and second there are
over 4500 different options to be considered. I'm sorry I wasn't more
specific in my question.

"roadkill" wrote:

Depending on how many different cells you may need to populate based on how
many values, another approach would be to put "if" formulas in the sells
where you want values to appear.

eg. if your "value" is in a3, then in cell d3 you could put
'=if(a3=123,125,"")'
similar formulas would go into e3 and ah3.
Will

"DA_Potts" wrote:

I want to use/create a function whereby if a value is equal to one number the
data i enter will go into one of a series of cells
example - if the value is 123 then the value of cell d3=125, if the vale is
124 the value of cell e3=125, if the value is 177 then the value of cell
ah3=125. Any suggestions?


Gary''s Student

Conditional placement of an item
 
With many values, the easy way is to create a table (either in a worksheet or
VBA) and use the table rather than individual lines of coding.

Also use a Sub instead of a Function to empty/fill the destination cells.

Let us know if you would like to pursue this further,
--
Gary''s Student - gsnu200741


"DA_Potts" wrote:

Thank you. This is an interesting start, however I may need to do some sort
of nesting as I actually have about 4500 options that would have to be
represented. I'm sorry I wasn't more specific in my original question

"Gary''s Student" wrote:

Function putval(i As Integer) As Variant
putval = ""
ad = Application.Caller.Address
If i = 123 And ad = "$D$3" Then putval = 125
If i = 124 And ad = "$E$3" Then putval = 125
If i = 177 And ad = "$AH$3" Then putval = 125
End Function

So put =putval(A1) in D3 and E3 and AH3
Then set A1 accordingly.
--
Gary''s Student - gsnu200741


"DA_Potts" wrote:

I want to use/create a function whereby if a value is equal to one number the
data i enter will go into one of a series of cells
example - if the value is 123 then the value of cell d3=125, if the vale is
124 the value of cell e3=125, if the value is 177 then the value of cell
ah3=125. Any suggestions?


DA_Potts[_2_]

Conditional placement of an item
 
I would definitely be interested in pursuing it. I do have to tell you that
I am, at best, an intermediate user, I am not strong in VBA or marcos... I
waas thinking about using a combination of the Address and Index functions,
but am not certain that that will work either. If you want to communicate
with me directly feel free to e-mail me at . Thanks.

"Gary''s Student" wrote:

With many values, the easy way is to create a table (either in a worksheet or
VBA) and use the table rather than individual lines of coding.

Also use a Sub instead of a Function to empty/fill the destination cells.

Let us know if you would like to pursue this further,
--
Gary''s Student - gsnu200741


"DA_Potts" wrote:

Thank you. This is an interesting start, however I may need to do some sort
of nesting as I actually have about 4500 options that would have to be
represented. I'm sorry I wasn't more specific in my original question

"Gary''s Student" wrote:

Function putval(i As Integer) As Variant
putval = ""
ad = Application.Caller.Address
If i = 123 And ad = "$D$3" Then putval = 125
If i = 124 And ad = "$E$3" Then putval = 125
If i = 177 And ad = "$AH$3" Then putval = 125
End Function

So put =putval(A1) in D3 and E3 and AH3
Then set A1 accordingly.
--
Gary''s Student - gsnu200741


"DA_Potts" wrote:

I want to use/create a function whereby if a value is equal to one number the
data i enter will go into one of a series of cells
example - if the value is 123 then the value of cell d3=125, if the vale is
124 the value of cell e3=125, if the value is 177 then the value of cell
ah3=125. Any suggestions?



All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com