+ Reply to Thread
Results 1 to 5 of 5

Macro that will display Yes if customers has marked X and other criteria

Hybrid View

geliedee Macro that will display Yes... 01-29-2015, 03:53 AM
alansidman Re: Macro that will display... 01-29-2015, 07:13 AM
Blokeman Re: Macro that will display... 01-29-2015, 07:48 AM
naveenmarapaka Re: Macro that will display... 01-29-2015, 08:04 AM
alansidman Re: Macro that will display... 01-29-2015, 11:16 AM
  1. #1
    Forum Contributor geliedee's Avatar
    Join Date
    10-14-2013
    Location
    Manila, philippines
    MS-Off Ver
    Excel 2007
    Posts
    400

    Macro that will display Yes if customers has marked X and other criteria

    Hi All,

    I have a a sheet which will contain thousand and thousand of numbers.
    I need a macro and This should show YES or NO based on the given criteria.

    For Column R:
    It should show YES if the the column H has an X marked.
    It should show NO if column H is blank.

    For Column S:
    It should show YES if the the column M has an X marked.
    It should show NO if column M is blank.

    For Column T:
    It should show YES if the value in Column G is YSTP, YGPY, YPAY and KUNA.
    It should show NOT Inscope if column G is blank or is not the same as above.

    For Column U:
    It should show YES if the Column O and Column P is the same.
    It should show "Blank" if Column O and Column P is blank and NO if its not the same.

    For Column V:
    It should show YES if the Column J and Column P is the same.
    It should show "Blank" if Column J and Column P is blank and NO if its not the same.


    Hope you can help sample.xlsxsample.xlsx

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2509 Win 11
    Posts
    24,996

    Re: Macro that will display Yes if customers has marked X and other criteria

    try this:
    Option Explicit
    
    Sub ams()
        Dim lr As Long
        Dim i As Long
        lr = Range("G" & Rows.Count).End(xlUp).Row
        
        Application.ScreenUpdating = False
        For i = 6 To lr
        If Range("H" & i) = "X" Then Range("R" & i) = "YES"
        Next i
        
        For i = 6 To lr
        If Range("M" & i) = "X" Then Range("S" & i) = "YES"
        Next i
        
        For i = 6 To lr
        If Range("G" & i) = "YSTP" Or Range("G" & i) = "YGPY" Or _
            Range("G" & i) = "YPAY" Or Range("G" & i) = "KUNA" Then
                Range("T" & i) = "YES"
        End If
        Next i
        
        For i = 6 To lr
        If Range("O" & i) = "" And Range("P" & i) = "" Then
        Range("U" & i) = ""
        ElseIf Range("O" & i) = Range("P" & i) Then
        Range("U" & i) = "YES"
        Else: Range("U" & i) = "NO"
        End If
        Next i
        
        For i = 6 To lr
        If Range("J" & i) = "" And Range("P" & i) = "" Then
        Range("V" & i) = ""
        ElseIf Range("J" & i) = Range("P" & i) Then
        Range("V" & i) = "YES"
        Else: Range("V" & i) = "NO"
        End If
        Next i
        
        Application.ScreenUpdating = True
    
    
    End Sub
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Macro that will display Yes if customers has marked X and other criteria

    Add;
    It should show NO if column H is blank.
    If Range("H" & i) = "" Then Range("R" & i) = "NO"
    It should show NO if column M is blank.
    If Range("M" & i) = "" Then Range("S" & i) = "NO"
    Please click the * Add Reputation if this helps
    If solved remember to mark Thread as solved

    "I'm glad to help and this is not meant to sound smart, but either you have super-human vision to see all those controls cleared one by one with the code I posted, or your computer is really slow."

  4. #4
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: Macro that will display Yes if customers has marked X and other criteria

    Try

    For i = 6 To lr
        If Range("H" & i) = "" Then Range("R" & i) = "NO" 
      Elseif Range("H" & i) = "X" Then Range("R" & i) = "YES"
       
    End if
    Next i

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2509 Win 11
    Posts
    24,996

    Re: Macro that will display Yes if customers has marked X and other criteria

    Thanks Blokeman, I missed that. Middle of the night here and the head was not to clear.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 09-03-2014, 09:32 AM
  2. Determine repeat customers vs. new customers based on purchase date
    By mktgdude in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-02-2013, 04:10 AM
  3. Replies: 3
    Last Post: 04-05-2011, 07:09 PM
  4. display customers in date column
    By billy3030 in forum Access Tables & Databases
    Replies: 6
    Last Post: 03-07-2011, 12:27 PM
  5. How to display check marked rows on second worksheet
    By lukengruven in forum Excel General
    Replies: 1
    Last Post: 09-16-2010, 10:57 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1