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

TAPS_MikeDion

Well-known Member
Joined
Aug 14, 2009
Messages
622
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!
 
I was trying to figure out your formula to edit it, but you are way beyond my knowledge of Excel.

I guess just going with col J being blank isn't going to work. In the attached pic you can see that it would also need to put an X in col C if col J val =0.00.

Where it shows 0.00, that should have an X in col C too. It will always be 0.00 unless col I has a numeric value, then col J will show the hours (formatted as #.##) and should not have an X in that rows col C.

Please see 2 attached pics. Thank you.

Screen Shot 2021-08-06 at 12.30.51 PM.png
Screen Shot 2021-08-06 at 12.31.43 PM.png
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Ok, try
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 & "="""")+(" & .Offset(, 7).Address & "=0)),""X"","""")")
   End With
End Sub
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Hi Fluff (or anyone who is capable of understanding Fluff's code),
After working on payroll today I realized I need to add one more thing to the code. It would also need to NOT put an X in col C if there is an existing X in col A.

Hopefully that can be added into the code.

Thank you very much!
 
Upvote 0
Maybe
VBA Code:
Sub Taps()
   With Range("C5:C" & Range("I" & Rows.Count).End(xlUp).Row)
      .Value = Evaluate("if((not(isnumber(" & .Offset(, 6).Address & ")))*(" & .Offset(, -2).Address & "<>""X"")*((" & .Offset(, 7).Address & "="""")+(" & .Offset(, 7).Address & "=0)),""X"","""")")
   End With
End Sub
 
Upvote 0
Wow, you're like lightning!

Thanks again Fluff.

Worked like a charm. I appreciate it.
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0
Hi everybody,

I know that Fluff initially solved this problem for me, which was fantastic, but I just ran into another issue. Can a check for data in column K be added to this formula as well? If any data is found in column K, then no X is put into the row in column C.

Thank you!
 
Upvote 0
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(, 8).Address & "="""")*(" & .Offset(, -2).Address & "<>""X"")*((" & .Offset(, 7).Address & "="""")+(" & .Offset(, 7).Address & "=0)),""X"","""")")
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,930
Members
449,094
Latest member
teemeren

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