+ Reply to Thread
Results 1 to 5 of 5

change value of a cell depending on multiple cell values

Hybrid View

  1. #1
    Registered User
    Join Date
    07-17-2016
    Location
    amritsar, india
    MS-Off Ver
    MS Office 2016
    Posts
    2

    change value of a cell depending on multiple cell values

    Hi there

    i wanted to make so that once i select the team in cell B12 from the dropdown list and set the number of points given in cell C12 then the final points for the specific team in cells H3:H6 ,depending of the team selected in cell B12, be updated.

    ex
    Cell B12 = Red
    Cell C12 = 50
    then the value in cell H3 will be updated to 200


    or
    Cell B12 = Green
    Cell C12 = -70
    then the value in cell H5 will be updated to 90

    i have attached the image for reference

    thank you in advance.

    Doido
    Screenshot (30).png

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,925

    Re: change value of a cell depending on multiple cell values

    You cannot have a formula in H AND a value: it is one or the other.

    You will need VBA for this.
    Last edited by JohnTopley; 07-17-2016 at 01:57 PM.

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: change value of a cell depending on multiple cell values

    Hi Doido,

    Welcome to the forum.


    Please try this code for sheet change event. Right click the Sheet Tab --> View Code --> and paste the following code into the opened code window --> Close the VB Editor --> Save your workbook as Macro-Enabled Workbook.

    As per the code, after selecting a Team from the drop down in B12, once you input Points in C12, the code will do the calculation based on the selected Team.

    See if this is something you can work with.
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    Dim rng As Range, cell As Range
    Set rng = Range("B3:B6")
    On Error GoTo Error
    If Not Intersect(Target, Range("C12")) Is Nothing Then
       Application.EnableEvents = False
       If Target <> "" Then
          Set cell = rng.Find(what:=Target.Offset(0, -1).Value, lookat:=xlWhole)
          If Not cell Is Nothing Then
             Cells(cell.Row, "H") = Cells(cell.Row, "H") + Target.Value
          End If
       End If
       Application.EnableEvents = True
    End If
    Error:
    Application.EnableEvents = True
    End Sub
    For details, refer to the attached.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Registered User
    Join Date
    07-17-2016
    Location
    amritsar, india
    MS-Off Ver
    MS Office 2016
    Posts
    2

    Re: change value of a cell depending on multiple cell values

    thanks a lot this solved my problem!!!!

    just out of curiosity and for making it look nicer could i have once after the result is updated in the H column that the B12 and C12 become blank again?

    if is not possible is ok you already solved my problem and i am very gratefull for it

    thank again

    doido

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: change value of a cell depending on multiple cell values

    Okay done. Please refer to the attached.

    If that takes care of your original question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.

    You may also say thanks to those who have put their time and efforts to help you in this forum by clicking the Add Reputation link under their posts, another way to say thanks.
    Attached Files Attached Files

+ 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] Change Row & Cell Colours Depending Upon Certain Values
    By jaredino in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-18-2016, 11:22 AM
  2. Change cell value within a row depending on other cell values within same row
    By cameron213 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-05-2013, 05:34 PM
  3. [SOLVED] copy row to other sheets depending on cell value (multiple values!)
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-26-2013, 07:01 AM
  4. copy a cell multiple times depending on cell value starting on a specific cell
    By weritadiojomiel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-17-2013, 05:25 AM
  5. [SOLVED] Adding Values in Multiple Offset Cells depending on the value of a different cell
    By lottidotti in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-19-2012, 11:35 AM
  6. changing row colour depending on multiple cell values
    By Erikp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-15-2011, 06:57 PM
  7. Change currency symbol of multiple cells depending on input into another cell
    By shaunnehughes in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-10-2010, 03:27 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