+ Reply to Thread
Results 1 to 5 of 5

Macro with Formulas

  1. #1
    Registered User
    Join Date
    01-12-2021
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    1

    Macro with Formulas

    Hello,

    I have a large dataset that I am trying to create a macro for. I want excel to do the following:

    If cell F2 says "Match" and cell G2 says "Yes", then drag drag cell P2 to P3. (currently cell P2 may say an ethnicity, but cell p3 says 'not specified'. If the first two criteria are met (Match, Yes), then I cell p3 should have the matching ethnicity instead of 'not specified. Sample.jpg

    I want this pattern to repeat in the entire data set which is over 19k lines.
    Please advise with a formula. And how to have the macro repeat all the way down.

    Thank you so much!

  2. #2
    Forum Contributor
    Join Date
    08-12-2020
    Location
    Atlanta, Georgia
    MS-Off Ver
    Office 16
    Posts
    241

    Re: Macro with Formulas

    Hi negskord,
    If the ethnicity is the same down the entire spreadsheet, you can put in P3 =if(and(f2="match",g2="yes"),P2,"Not Specified"). Then select P2 and P3, and drag/copy down to the bottom of your spreadsheet, or you can try selecting P2 and P3, then place your cursor over the bottom right corner square, and when you see the mouse show +, double click (fast) and it will copy down the length of the form as long as there are no spaces on both sides of the column.
    If your ethnicity changes as you go down, copy paste values the entire P row to a new unused column (example the Z column), then in P2 put =Z2. Then copy P2 and P3 down. Hide Z if you want.
    -Squeaky

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Macro with Formulas

    Looks like you could AutoFilter on 2 Columns ("Match" and "Yes") and follow it up with:
    Please Login or Register  to view this content.
    If you don't have it solved by the time I get back (from the dentist!!!), I'll have a look.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Macro with Formulas

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Macro with Formulas

    Another possibility within memory. Should be faster.
    Please Login or Register  to view this content.

+ 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. Generating formulas into specific cells, based on various formulas
    By S_O_A_L in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2016, 08:45 PM
  2. [SOLVED] Formulas in VBA/Macro
    By Shaner73 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-19-2016, 03:40 PM
  3. [SOLVED] From Many Formulas to one MACRO
    By isasa74 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-22-2014, 05:55 PM
  4. Replies: 5
    Last Post: 09-25-2013, 02:51 PM
  5. macro for formulas.
    By meezadahsra in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2013, 03:42 AM
  6. Help modifying macro to wrap iferror formulas around existing formulas
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2012, 02:04 PM
  7. Formulas Before Macro
    By ozgurcagin in forum Excel General
    Replies: 5
    Last Post: 06-25-2010, 06:25 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