Forum Discussion
LauraJackson
Jun 30, 2023Copper Contributor
Excel formula
Hello formula friends,
I have a column (let's say column B) that I would like to create a formula for. The gist is:
- if column A has a value, then column B should be empty.
- if column A does NOT have a value, then column B should keep the value it currently has.
Any thoughts on how I can accomplish this?
- leoperdiaBrass Contributor
Hi LauraJackson
Let me clarify something if you need to take actian based on data in colunm A or B you need a new colunm to do it, let's suppose C. If you do it in this way, yo can inlcude following formula en column C.
IF (A2<>"", "", B2).
If you like to keep just columns A and B you can "hide" values in column B with conditional formatting settting font color like a backgroud color. You can use following condition in conditional formatting =$A4<>""
I'm not sure if I got your point. If not please share an example.
Regards
- LauraJacksonCopper Contributor
Hi Leo,
Thank you for your help. For our purposes let's pretend B2's value is currently "purple".
If A2 is not blank, then populate B2 from A2.
If A2 is blank, then keep "purple".- leoperdiaBrass Contributor
Hi LauraJackson, what you want is impossible using just formulas, if you need to keep just two columns. This is Because you can not have a previous value and a formula in the same cell. At least to my best knowledge, you have these options:
1-Add a column C which has logic and expected results
A B C Yellow Purple Yellow White Green White Purple Purple 2- Make it through VBA code, it is possible using the event change of the worksheet. But I'm not sure if you like to use code.
Let me know if the second option works for you and I'll tell you the code.
Regards