+ Reply to Thread
Results 1 to 10 of 10

If/Then Output to Corresponding Row

  1. #1
    Registered User
    Join Date
    03-12-2015
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    22

    Question If/Then Output to Corresponding Row

    Hello again!

    I am looking for help on a macro again. This time I am trying to search through my list of numbers with an If/Then statement. I am trying to have it search for a specific number in column D and E and output the value 3 to the corresponding (same row) in G. I am still working on this but I thought I would post just in case someone out there can help faster than I can research. I am getting a mismatch error when I run it.

    Thanks in advance!

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    03-12-2015
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    22

    Re: If/Then Output to Corresponding Row

    I figured out a way to do this but want to make sure I'm not making it too complicated. My problem is now that I have 50 different combinations of x2 and y2 to assign a number to.

    Please Login or Register  to view this content.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,983

    Re: If/Then Output to Corresponding Row

    One way (not the fastest):

    Please Login or Register  to view this content.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,983

    Re: If/Then Output to Corresponding Row

    Better, no loop:

    Please Login or Register  to view this content.

    Regards, TMS

  5. #5
    Registered User
    Join Date
    03-12-2015
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    22

    Re: If/Then Output to Corresponding Row

    Okay - so what if I have 50 different combinations of what the D and E values can be (think a 5x10 grid - each cell having a specific value). Would I have to repeat the IF statement 50 times to output the specific value?

  6. #6
    Registered User
    Join Date
    03-12-2015
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    22

    Re: If/Then Output to Corresponding Row

    For Example:

    Please Login or Register  to view this content.

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: If/Then Output to Corresponding Row

    Try
    Please Login or Register  to view this content.
    There are other approaches, if you have your 5X10 grid somewhere on a sheet, the values wouldn't have to be hard-coded in as in my snippet.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  8. #8
    Registered User
    Join Date
    03-12-2015
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    22

    Re: If/Then Output to Corresponding Row

    Thanks, I was just looking into how to use "Case" to help with this. I do have them on my sheet but have no idea how to reference the cell inside a case? I am attaching the sheet I am working off of.

    What I am trying to do is located on the 'Original Formula' sheet but I am first breaking it down into small sections of code hoping that will help me out. If you look at that sheet, I am trying to find a sum over 2500 possible combinations of points.RioRancoDemand.xlsx.xlsm

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,983

    Re: If/Then Output to Corresponding Row

    Personally, if you have a lot of combinations, I'd put them in a table and use a lookup of sorts. I would NOT individually code all the variations.

    When you ask a question, start at the complex end, don't start with the simple option and build up ... Ok, that answers the case where I have 50 combinations; what about, 500, 1000, etc, ...

  10. #10
    Registered User
    Join Date
    03-12-2015
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    22

    Re: If/Then Output to Corresponding Row

    I will start researching that now. Thank you for the help again!

+ 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. [SOLVED] Cell reference, output dates to numeric. Should output as text
    By lifeseeker1019 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-02-2015, 05:51 PM
  2. [SOLVED] Comparing two cells for similarities and output a third cell (if C1 = B1, then output A1)
    By PERFECT777 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-26-2013, 12:37 AM
  3. [SOLVED] Paste variable output (SQL Output) into a single cell.
    By fblaze in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2013, 06:24 AM
  4. Looping through columns to copy output into other sheet, and saving output
    By eludlow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2009, 06:27 AM
  5. Importing several Output sheets into one consolidated Output Sheet
    By Ugh_Der in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-13-2009, 08:58 AM

Tags for this Thread

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