+ Reply to Thread
Results 1 to 4 of 4

What-If Analysis

  1. #1
    Forum Contributor
    Join Date
    06-16-2008
    Posts
    115

    What-If Analysis

    I need help with what-if analysis. I need to compare multiple columns from B to E, and get the input from Column A.

    For instance, I have 10 health supplements in column A. In column B, D, E, & F, represent 4 times in the day. B - E has "Yes" in the column if the supplement is supposed to be taken at that time of day. What I need to do is to look for "Yes" in columns B - E, and replace the "Yes" with the name of the supplement from column A. Example pasted below:

    Product Morning Noon Afternoon Evening
    Hydrocuts Yes Yes Yes
    Protein Yes Yes Yes
    ZMA Yes Yes
    AKG Yes Yes Yes
    Viatmins Yes Yes
    Antioxidant Yes Yes

    Any help would be appreciated.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: What-If Analysis

    Give this macro a try on a copy of your sheet:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    06-16-2008
    Posts
    115

    Re: What-If Analysis

    Thanks so much for your reply. A guy from another forum, gave me a macro that works:

    Sub Whatif()
    Dim cl as Range
    For Each cl in Range("$B$2:$E$11")
    If UCase(cl) = "YES" Then cl = Cells(cl.Row,"A")
    Next cl
    End Sub

    I'll try yours too. Thanks again for your help.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: What-If Analysis

    Please edit your post to add code tags.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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