Assign Cell Value Based On Another Cell Value In Range

Jul 2, 2014

I'm a VBA beginner In my Excel worksheet, I have 1 column with data (column B). The data is in rows 5-250. This data is student majors.

Now, I want to assign each major a department and display the department in column U.

I was able to complete this for row 5 by using If-Then statements (see snapshot below):

[Code] ......

However, I would have to copy and paste that code over 200 times and replace the B5 and U5 with the correct row number. How can I get the macro to do this for each cell in a specified range?

I tried the following, but it did not work:

[Code] .....

View 3 Replies


ADVERTISEMENT

Assign Range Name Based On Cell Values

Jan 24, 2009

In my workbook sheet 11 has some ranges that need to have names based on cell values in sheet2 (for purposes of data validation lists).

Range S28:S46 will assume the name of sheet2A11 & sheet2A3.
(example name period_1unit_1)

Range U28:U46 will assume the name of sheet2A11 & sheet2A4.

Range W28:W46 will assume the name of sheet2A11 & sheet2A5

Right now I am calling the code when something is entered into A11.

I have tried if statement and select case, but I ran into complications with both.

I have posted both codes with the questions I have concerning those codes.

View 6 Replies View Related

Assign Yes / No To Cell Based On Meeting Some Criteria?

Jun 24, 2014

I need to write an excel function/macro/code to assign yes or no to a cell if the Description fits a certain category. I have attached a sample workbook and will explain what I mean.

In the sample workbook, there is data on a company. This included a unique ID, city, state, and description. What I want to do is fill out the yes/no column. So if a particular company has 2 of the 4 necessary "Descriptions", then column G will return yes, otherwise No. It must return yes for a particular company/ID if 2 of the "Descriptions" are "Sale", "Service", "Business", or "Par". I only want it to count at least two unique descriptions.

For example, in the sample workbook, Company A has all 4 of the necessary descriptions, thus everything in column G for this specific client should be yes. For Company B, only 1 of the 4 descriptions matches, so it returns No for all Company 2 columns. Company C has 2 of 4, so it returns yes for these columns. Note, it doesn't matter for Company C that "Business" was listed twice. It only needs to count the first unique time that description occurs.

View 6 Replies View Related

Assign Value To Cell Based On Its Background Color?

May 15, 2014

I have an excel spreadsheet that 7 different categories (eg. Ave waittime, Avg loadtime, etc) that I have conditionally formatted based on 5 ratings (each rating a different color Green, light green, yellow, red, and purple) I would like to be able to give each cell a value based on what color it is eg. Green=5, light green=4 and so on.

View 2 Replies View Related

Assign Data To A Separate Cell Based On Value Of Yet Another

Nov 7, 2007

I have a "memo of meeting" excel document used to capture notes during client meetings. In this document there's a cell for "purpose", "agenda", and "notes". The 'consultation type' cell is a drop-down populated by values set in Sheet2. The 'agenda' & 'notes" cells are then populated with information (also stored in Sheet2) based on what drop-down option was chosen in the 'purpose' cell. I'm currently making this happen with basic =IF() statements; however, the problem is that by doing it this way, the =IF() statement must reside in the actual cell which will end up showing the data.

This is undesirable as there may be additional notes, agenda items, etc. that I'll need to add during the meeting and as it's currently setup, I can only have either the pre-populated info OR the ad-hoc notes - not both. It seems a simple fix. Maybe put the =IF() statement in a cell off to the side but have it "assign" the value to 'agenda'/'notes' but that doesn't seem to work.

View 9 Replies View Related

Does The Line Of Code Assign The Value Of Cell A5 To The Range

Dec 17, 2008

Does the line of code assign the value of cell A5 to the range or is it just a startinig point?

View 9 Replies View Related

How To Assign Range Using Defined Cell In Excel

Nov 22, 2011

How to assign a range in excel using a defined (different) cell.

I've this formula
=INDEX($A$1:$A$17,RANK(B2,$B$1:$B$17))

I want to to choose the range from A1:A17 ... i'll use the formula too many times with different ranges for example A1:A21 and i want to know a way to insteed to change it manually each time to make the formula consider the value i insert in a different cell, so i can only change the value in this cell.

for example:

=INDEX($A$1:$A$D1,RANK(B2,$B$1:$B$D1)) so it can consider the value in cell D1

View 7 Replies View Related

Assign Name To Range Using Variables And Cell Values

May 23, 2009

For example, I have the numerical value "400" in R1C2 and that value would be used in the name "D400" which is to be assigned to R1C1:R5C2.

The code I have is:

Range("R" & DRow & "C1:R" & DRow + 4 & "C2") = "D" & Cells(DRow, 2).Value

but is throwing up the error:

"Run-time error '1004':
Method 'Range' of object '_Global' failed

DRow increases dependant on other variable data.

Also, am I right to be using R1C1 instead of A1, or can the same be achieved using A1 references? If so, I think I may not be able to see the wood for the trees.

View 9 Replies View Related

Assign Names Dynamically Based On Cell Content

Jul 10, 2009

I do have a data set from A1:C8 as follows:-
Brand Name(A1)Sales Value(B1)Margin(C1)Levi's100002000Arrow150002500Allen Solly120001300Hanes80001000John Miller250004500Disney280003200Ray Ban180002100

The above brands are categorized as follows:-
Brand NameProposed CategoryLevi'sConsignmentArrowBrandAllen SollyBrandHanesBrandJohn MillerPrivate LabelDisneyBrandRay BanConcessionaire

I would like to put formula from D1:D8 in such a way so that the Proposed categories are extracted automatically through formulae. This will help in getting the contribution calculated from different categories.
Brand Name(A1)Sales Value(B1)Margin(C1)Category(Desired Result)(D1)Levi's100002000ConsignmentArrow150002500BrandAllen Solly120001300BrandHanes80001000BrandJohn Miller250004500Private LabelDisney280003200BrandRay Ban180002100Concessionaire

View 9 Replies View Related

Assign Group Names Based On Cell Values

Feb 19, 2010

I have two tables below. First table contains the list of domain names (given just for example, actual list may contain several more such Domain names) with the group names assigned to them. Second table shows the criteria for assigning them the group names:

Sheet2ABCDEFG1Table 1Table 22Domain NameGroup NameDomain NameGroup NameDomain NameGroup Name3NCG-W3K-SAT14-0DOSSNCG-W3K-EEC-SUN16-3EECEXCEEC4SVL-WIN-SAT08-0LABSNCG-W3K-SUN16-0DOSSDCDC5SVL-WIN-SAT06-0LABSNCG-W3K-TUE01-0DOSSNCGDOSS6NCG-W3K-MON04-0DOSSNCG-WIN-EXC-SUN21-0EECDMZETIS7NCG-W3K-EXC-MON04-3EECNCG-WIN-EXC-SAT16-0EECSVLLABS8NCG-W3K-EXC-MON03-0EECNCG-W3K-X64-DC-SAT14-0DC9NCG-W3K-EXC-TUE01-0EECDMZ-NCG-W3K-X64-SUN12-0ETIS10NCG-W3K-EXC-SUN15-0EECDMZ-NCG-W2K-SUN12-0ETIS11NCG-W3K-X64-EXC-SUN16-0EECNCG-W2K-SUN20-0DOSS12DMZ-NCG-W3K-SUN11-0ETISNCG-W3K-MON03-3DOSS13NCG-W2K-DC-SUN11-3DCSVL-DMZ-WIN-SUN12-3LABS14NCG-W3K-X64-DC-SUN10-3DCSVL-DMZ-WIN-SAT10-0LABS15SVL-DMZ-W2K-SUN12-3LABSDMZ-NCG-W3K-SUN12-0ETIS16NCG-W3K-EXC2-MON03-3EECDMZ-NCG-W3K-SUN10-0ETIS17NCG-W2K-SAT17-0DOSSNCG-W8K-X64-DC-SUN10-4DC18NCG-W3K-X64-SUN10-0DOSSNCG-W3K-TUE01-3DOSS19NCG-W3K-TUE00-0DOSSNCG-W3K-DC-TUE02-0DC20NCG-W3K-X64-SAT15-0DOSSSVL-WIN-SAT11-0LABS21NCG-W3K-WED00-0DOSSSVL-WIN-SAT07-0LABS22NCG-W8K-X64-SUN19-0DOSSNCG-W2K-SUN17-0DOSS23NCG-W3K-EXC-SUN20-0EECNCG-W3K-SUN20-0DOSS24NCG-W3K-ULZ-SUN14-0DOSSNCG-W3K-TUE22-0DOSS25NCG-W3K-TUE03-0DOSSSVL-WIN-SAT07-3LABS26NCG-W3K-ULZ-TUE00-0DOSSNCG-W3K-MON05-3DOSS27NCG-W3K-SUN19-0DOSSNCG-W8K-SUN18-3DOSS28NCG-W3K-EEC-SUN19-0EECNCG-W8K-SUN22-0DOSS29NCG-W3K-EEC-SUN20-3EECNCG-W8K-X64-DC-SUN11-0DC30NCG-W3K-EEC-THU00-0EECNCG-W3K-SUN17-0DOSSExcel 2007

My concern is to automate this process using a VBA code. How can I search for the keyword given in Table 2 in the first column of Table 1 and assign the group names as it is assigned currently, considering the below conditions and criteria.

1) The correct group name should be assigned to the Domain name containing the keyword given as per criteria in Table 2

2) It is possible that the domain name will include more than one keywords given in Table 2. For example Cell number A7 contains both keywords NCG and EXC, in such cases the preferance should be given to EXC and we will assign the group name as EEC. And in Cell number A12 also contains both NCG and DMZ, again the preferance should be given to DMZ and we have to assign group name as ETIS.

That means we will give second preference to keyword NCG. If domain name contains none of the keywords except NCG as per given criteria then only we will assign grup name DOSS.

View 9 Replies View Related

Assign A Score Value To The Cell That Contains A Percentage Depending On A Range

May 2, 2007

I have a spreadsheet with several columns that have percentages as a whole number and with a decimal format. I need assign a score value to the cell that contains a percentage depending on a range.

For example:

If cell A1 has a value between 97%-100% then A2 should display "15", however if A1 has a value of 90%-96% then it should display "12" and if A1 has a value of less than 89% then it should display "0".

View 9 Replies View Related

Assign Specific Number To Cells Based On Another Cell Value In String

Feb 27, 2013

So I have this list (I made it a little bit shorter).

So what you see is two different tasks (01 and 02) and three different conditions (A, B and C). In column B you see the result I would like to have. '/Searchtask_01.html' in A1 belongs to conditions A, because it is in session A. However, '/Searchtask_01.html' in A10 belongs to conditions B, because it is in session B.

How to get the results in B with a formula?

View 1 Replies View Related

Assign Active Cell In Macro With Dynamic Cell Choice

Dec 29, 2009

Before unloading a userform the range to select the active cell is set to

View 3 Replies View Related

Excel 2010 :: How To Delete A Name From One Cell And Assign It To A Different Cell

Dec 10, 2013

I have excel 2010. I have a worksheet with formulas that refer to a labelled cell, and I want to change the location that they refer to. When I select the name in the Name Box and delete it or type another name it has no effect on the name of the cell.

View 2 Replies View Related

Assign Values To A Cell Based On Values Of Another

Jul 7, 2013

I'm attempting to assign 1 of 4 predetermined values to a cell based on the values of entries in another cell.

View the example attached : Value assignmts.xls

Assign the Value of 1, to (D8) when any value entered in (C9) is equal to or over 380, but less than 410.
Assign the Value of 2, to (D8) when any value entered in (C9) is equal to or over 410, but less than 440.
Assign the Value of 3, to (D8) when any value entered in (C9) is equal to or over 440, but less than 470.
Assign the Value of 0, to (D8) when any value entered in (C9) less than 380.

View 9 Replies View Related

Excel 2010 :: Return Range Of Cell Concatenated Based On Single Cell Value

Jul 2, 2012

I have a range of cells each containing a name. Based on a number that has to be entered manually I want excel to return the names concatenated in one cell. So for example:

Number of variable entered: 5

q9001
q9002
q9003
q9004
q9005
q9006
etc.

Should give me: "q9001 q9002 q9003 q9004 q9005"

I have been trying to work with formulas using IF and CONCAT functions. But so far I haven't figured out how to have excel return me the correct amount of variables for each separate number that can be entered seeing the number of variables entered can vary from 1 up to 50.

(Using Excel 2010)

View 7 Replies View Related

Find Last Cell In Range, And Changing Another Cell Based On Offset Text

May 4, 2009

If i have a range say E12:O12 and want to find the last cell before blank, lets say it finds m12 as the cell with the value before blank. then with m12 it needs to determine weather row 11 in the same column has Text either "S" or "F" if "S" then m12 = t if "F" then m12 offset(1,-1) = t. And just to make things more difficult i need the range E12:O12 to step 2 as well until it gets to E208:O208 .Noting that row 11 never changes and will always have either an "S" Or an "F"

and also t = time()

View 7 Replies View Related

Dynamic Range Based On Cell Between A Header And Footer Cell

Sep 2, 2008

I need to create a dynamic range based on cell between a header and footer cell. The header cell ( A8 ) will remain static, however, the footer cell starts at A10 and then will move down as rows are added.

View 9 Replies View Related

How To Copy Cell Range Based On Individual Cell

Mar 15, 2014

I have a spreadsheet (book1.xls) that has a column with 13 names down the side and 31 other rows (dates of the month)

Mike1 1 2 3 4 5 6 7 8 9
Mike2 1 2 3 4 5 6 7 8 9
Mike3 1 2 3 4 5 6 7 8 9
Mike4 1 2 3 4 5 6 7 8 9 etc

I have selected all 13 rows and 7 days and named them 'week1', and the next 7 days 'week2', the next 7 days 'week3' etc/What i want is to display the named range based on a single cell selection based on a cell value in a different sheet.

The basics of it should be "If cell C1 = 1 then show me 'week1' or if cell C1 = 2 then show me 'week2' etc.

View 4 Replies View Related

Highlight Cell Based On Value Falling Between Certain Range In Another Cell?

Feb 1, 2012

Let's assume Cell A2, A3, A4, etc, only contain names/text.

Then let's assume I have set up cell B2, B3, B4, etc, to contain a percentage value based on a formula and some other entries I have made.

It should be simple, but I'm having trouble - how do I set up A2, A3, A4, etc, to highlight into different colours based on Column B's data/percentage falling into a certain range?

ie: - if B2 is between 0% - 25%, then highlight A2 green
- if B2 is between 26% - 50%, then highlight A2 orange
- if B2 is between 51% - 100%, then highlight A2 red

View 2 Replies View Related

Display Cell X Of Range Based On Another Cell Number

Feb 18, 2008

I am trying to create a table, based on what people predict in sports games. I have most of it in place, but I have hit a brick wall where one part of it is concerned. For example, cells M43:M56 have the scores for each week of what one person predicted., so it could be 2,5,7,2 and so on. What I then need the table to do is determine which round or week it is and display the relevant score. So based on the above let's say it's round 3, and his score would be 7 for the week, and the cell to the right of this shows the week's score plus his total score so far.

View 2 Replies View Related

Lock Cell Range Based On Cell Value?

Oct 23, 2012

I have a spreadsheet that has number between 1-20 entered in every cell in column B all the way down to row 15,000

I need to program something in VBA that will look at each number and then lock a certain range in that row based on that value in column B

For example:

In B3 there is the number '5' therefore I would want it to stop the user entering anything between C3 and G3

In B4 there is the number '3' therefore I would want it to stop the user entering anything between C4 and E4

In B12500 there is the number '14' therefore I would want it to stop the user entering anything between C12500 and P12500

I don't want to have to type out programming for each criteria from 1-20 for 15,000 rows!

View 3 Replies View Related

Set Cell Value Based On Range Of Cell

Feb 1, 2014

I have a worksheet that uses a rating system to rate an item based on 5 different criteria columns with an overall rating column at the end. The rating scale is E=Excellent, S=Satisfactory, and U=Unsatisfactory. If any of the criteria columns get a "U" the overall all rating automatically becomes a "U", same thing occurs in regards to an "S" rating in the overall column. I'm trying to figure out a formula that would automatically set the overall column based what is entered in the criteria columns. I've been at this for hours and am basically back to square one.

View 2 Replies View Related

If Cell Contains Word Then Assign Value

Jan 29, 2010

Basically I have columns A and columns B.

Column A contains a list of words
Column B is blank.

If a cell in column A contains a word like "univ", I want the number 1 to appear in the respective row in column 2.

If a cell in column A does not contain a word "univ", I want the number 0 to appear in the respective row in column 2.

View 14 Replies View Related

Assign Macro To A Cell

Jul 21, 2009

I would like a to activate a form every time I click in a given cell. how to do this?

View 4 Replies View Related

Assign Name To Cell Via Code

Mar 30, 2008

You can use VB to put a Range.Value or Range.Formula into a specific cell.

How do you assign a name to that Range using VB code?

View 6 Replies View Related

Assign Value To Text Formatted Cell

Dec 30, 2008

I want to be able to "count" apples and oranges. Is there a way to record a particular text in a text formatted cell and count it. e.g. 10 cells, 3 say "apples", three say "oranges", 4 say "plums". I want excel to keep track of the three types of fruit when I change them and give me a running number of each.

View 2 Replies View Related

How To Use Multiple Buttons To Assign Different Value To A Cell

Jul 1, 2014

There are 10 rows of data, and would like to assign value at the end of each row as "initiated" "In the process" "Needs to be Reviewed" "Completed", by using Buttons with different macros.

View 2 Replies View Related

Assign String As Cell Hyperlink?

Nov 24, 2011

I can't work out how to strip the hyperlink address in cell rRecordID(1,11).

Code:
Private Function GetRecord(lRow As Long)
Dim i As Long
Dim vMyCopy As Variant

[Code].....

View 3 Replies View Related

How To Assign Text From Textbox To A Cell

Sep 3, 2012

I have used a textbox ( not an activeX text box) to get input from user. I want to get that value into a cell.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved