Addidng data automatically after Conditions are met

kshora

Board Regular
Joined
Aug 2, 2006
Messages
211
Can I add data in a cell automatically, after the conditions are met in two different cells

e.g A1 has 3600
A2 has 0.33
When I enter the above data in A1 and A3, I want to get say "184T" in Cell A3. OR if I enter 1800 in A1, data in A3 should be say "145T".
There are lot more combinations to work with.

Your help is highly appreciated

Thanks and Regards

KShora
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,

THis code needs to go into the relevant sheet code window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Or Target.Address = "$A$2" Then
    Select Case Range("a1") & Range("A2")
        Case 36000.33
            Range("a3").Value = "184T"
    End Select
End If
End Sub

you will need to add all other combinations yourself by adding and changing these lines

Code:
        Case 36000.33
            Range("a3").Value = "184T"
 

kshora

Board Regular
Joined
Aug 2, 2006
Messages
211
Hi

When I put the code in the code window (pressing ALT+F11), and change the data and cells as required, and after I close the window and go to tools>macro>macros; this macro does not appear and hence cannot run.

Am I doing any mistake

Regards

KShora
 

kshora

Board Regular
Joined
Aug 2, 2006
Messages
211
Hi

I think I figured it out, and am sure that I could not explain the problem correctly. Let me try to explain my problem again

eg. the following is a data sheet, with values, now this data is already there, what I want is that I want certain data in column D after the conditions in column A and column B are met. say D1 should be 56T, D2 should be 56H, D3 should be 184TS and so on.

A B C D E
1 900 1/3 00 - 21 56
2 900 1/2 22 - 29 56
3 900 3/4 30 - 40 184
4
5 1200 1/2 00 - 16 56
6 1200 3/4 17 - 22 56
7 1200 1 23 - 27 145
8 1200 1 1/2 28 - 35 182
9 1200 2 36 - 40 184

Your help is highly appreciated

Thanks and Regards

KShora
 

kshora

Board Regular
Joined
Aug 2, 2006
Messages
211

ADVERTISEMENT

The worksheet got messed up
A, B, C, D AND E are the columns and 1 to 9 are the rows, the values are
A1=900, B1=1/3, C1=00 - 21, D1 is blank, E1=56 and so the rest of the work sheet, I hope the above is clear

Please help me out.

Thanks and regards

KShora
 

xcellnoob

Board Regular
Joined
Apr 6, 2005
Messages
188

ADVERTISEMENT

how many different conditions are there? Basically, how many different D-cell values are there?
 

kshora

Board Regular
Joined
Aug 2, 2006
Messages
211
Hi
Thanks for your reply

There are 9 different values in D-cell

4 different values in A-cell
21 different values in B-cell

Thanks and regards

Kshora
 

xcellnoob

Board Regular
Joined
Apr 6, 2005
Messages
188
you could set up a table with all the different combinations and use vlookup to grab the resulting value. you can email me your file if you'd like and I can take a quick peek.
one2345@eml.cc
 

kshora

Board Regular
Joined
Aug 2, 2006
Messages
211
I sent you the email, with a portion of the worksheet

Regards

KShora
 

Forum statistics

Threads
1,141,626
Messages
5,707,489
Members
421,510
Latest member
haroonstr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top