Formula Help

RamyJo

New Member
Joined
Nov 13, 2022
Messages
8
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
While working I created a spreadsheet that saves me alot of time daily but I'm stuck on a formula I need for the data in one workbook. I have a list of names in Cell A. That same list is broken down into different groups in other cells (Cells C, E, G, M). I am wanting a formula that I can enter into the other cells so that when i delete a name in column A it will delete the same name in the other cell it's in and then leave the other cell blank. I tried put the formula =a2, =a3. etc... in column c but when i deleted the info in column a it put a 0 in cell c...

Thanks for any and all help.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Any cell can only have either a hard-coded value, or a formula, but NEVER both at the same time.
If the "values" (C, E, G, M) can be derived from column A, then it is easy to make them return nothing when column A is nothing, i.e.
Excel Formula:
=IF(A2="","",formula)

Otherwise, the only way to do what you want would require the use of VBA.
Are you open to that type of solution?
 
Upvote 0
Yes I am open to a VBA solution. I have used them before but just don't know how to write them (yet!).

I'm wanting to find some kind of online training or classes to take to learn all the ins and outs of Excel.
 
Upvote 0
Right-click on the sheet tab name at the bottom of the screen, select "View Code", and copy/paste this code in the VBA Editor window that pops up:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim rng As Range
    Dim cell As Range
    
'   See if any cells updated in column A
    Set rng = Intersect(Target, Columns("A:A"))
    If rng Is Nothing Then Exit Sub
    
'   Loop through all cells in column A
    Application.EnableEvents = False
    For Each cell In rng
'       See if row>1 and value is blank
        If cell.Row > 1 And cell.Value = "" Then
'           Clear columns C, E, G, and M
            cell.Offset(0, 2).ClearContents
            cell.Offset(0, 4).ClearContents
            cell.Offset(0, 6).ClearContents
            cell.Offset(0, 12).ClearContents
        End If
    Next cell
    Application.EnableEvents = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top