![]() |
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? |
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? |
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? |
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? |
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? |
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? |
All times are GMT +1. The time now is 10:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com