Put an X in a cell based on data in 2 other cells?

TAPS_MikeDion

Well-known Member
Joined
Aug 14, 2009
Messages
619
Office Version
  1. 2011
Platform
  1. MacOS
Hi All,

Is there a formula that can be put into a macro to place an X in a cell based on data in two other cells?

What I'm trying to do is create a macro that when run will put an X in column C (starting from C5 to C???) only if there is either a numeric value in cell I5 or an X in cell J5. And this would need to run through from C5 to the last row in column C with data.

As always, thank you for any help given!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Do you want a formula in the cell, or a hard value?
 
Upvote 0
Hi Fluff!

Oops, I just realized I mis-typed what I was looking for! LOL

I'm just looking to put an X into any cell in column C (again, start at C5) when a number DOES NOT exist in column I or an X DOES NOT exist in column J, but I wanted to have the formula in a macro so I can run it each time I need to have an X put into column C.

This is for a filter I have that hides any row in which column C contains an X. It's just such a pain to manually go through hundreds of rows and put an X in each cell in column C if the aforementioned data DOES NOT exist in either columns I or columns J.

Thank you.
 
Upvote 0
That does not answer my question, do you want a formula in col C or hard values?
 
Upvote 0
Ok, how about
VBA Code:
Sub Taps()
   With Range("C5:C" & Range("I" & Rows.Count).End(xlUp).Row)
      .Value = Evaluate("if((not(isnumber(" & .Offset(, 6).Address & ")))*(" & .Offset(, 7).Address & "<>""X""),""X"","""")")
   End With
End Sub
 
Upvote 0
Wow, you're good! :giggle: It worked perfectly. Only one problem and it's my fault for not realizing it.

I'm super sorry Fluff, but when I ran your code I was reminded that there are some column J cells that may also contain a numeric value as well as an X.
 
Upvote 0
So do you just want to check if col J is blank?
 
Upvote 0
Ok, how about
VBA Code:
Sub Taps()
   With Range("C5:C" & Range("I" & Rows.Count).End(xlUp).Row)
      .Value = Evaluate("if((not(isnumber(" & .Offset(, 6).Address & ")))*(" & .Offset(, 7).Address & "=""""),""X"","""")")
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

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