# 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?

## Assign Unique Number To A String

Jun 4, 2008

I'm currrently using column I and col J

in col I are all the units of measurement: KG, PKT, BAG
in ColJ is the formula to return:

KG as 9999999
PKT as 8888888
BAg as 7777777

if(i2=kg, 999999999,"false!")

i was thinking of using if....but triple if formulas would be long isn't it?

PART2 of this would be using:
=IF((SUMPRODUCT(--(db!\$A\$2:\$A\$36000=\$B\$1),--(db!\$F\$2:\$F\$36000=C\$5),--(db!\$G\$2:\$G\$36000=C\$6),--(db!\$E\$2:\$E\$36000=\$A7),--(db!\$D\$2:\$D\$36000=\$B7),db!\$I\$2:\$I\$36000))=9999999,"KG","Invalid")

to check 5 values and if it is 999999999 it'll return KG
8888888 PKT
7777777 BAg

## IF Formula: Assign A Specific Letter To Each Rating, Depending Of The Obtained Number

Jun 15, 2009

I have some delivery ratings from suppliers, and I want to assign a specific letter to each rating, depending of the obtained number. Criteria is:.........

## Calculate Number Of Days Between 2 Dates And Then Assign Number Based On Answer

Mar 22, 2014

How to create a spreadsheet with what I think will be a very simple formula?

If date in B2 - date in A2 is 1 or less days, put a 1 in cell C2.
If date in B2 - date in A2 is 7 or less days but more than 1, put a 2 in cell C2.
If date in B2 - date in A2 is 30 or less days but more than 7, put a 3 in cell C2.
If date in B2 - date in A2 is 90 or less days but more than 30, put a 4 in cell C2.
If date in B2 - date in A2 is 91 days or more, put a 5 in cell C2.

OR

Another, maybe simpler, way of saying it is:

If date in B2 - date in A2 is 1 or less days, put a 1 in cell C2.
If date in B2 - date in A2 is 2-7 days, put a 2 in cell C2.
If date in B2 - date in A2 is 8-30 days, put a 3 in cell C2.
If date in B2 - date in A2 is 31-90 days, put a 4 in cell C2.
If date in B2 - date in A2 is 91 days or more, put a 5 in cell C2.

## Conditional Rank Based On Whether A Criteria Cell Includes A Specific Text String

May 8, 2009

I'm racking my brains as to how I can structure a formula to conditionally rank a value in an array against only those values in the array whose corresponding criteria cell includes a specific letter.

So for example I have a list of 12 values, say 126; 239; 0; 171; 162; 157; 130; 199; 122; 153; 0; 15.
Each of those values corresponds to a heading, say: CDE; DFE; FGE; DFE; ERD; DEA; BDF; DFB; CDE; CEF; CAB; FAB. As you will note some of the headings may or may not be the same and may or may not include the same letters in different orders.

How can I write a formula that ranks in ascending order a given value drawn from the above list (which will be in another cell but which in this case is, let's say, the first value: 126) only against those values whose heading includes a specific character, for example the character C (the character in question will vary and be defined in a specific cell).

As an added complication I need the ranking calculation to exclude any zero values. So in the above example what the formula needs to do is rank the value 126 against a sub-set of the whole array comprising only the values 126; 122; 153; 0.

The answer I need is 2 because, discounting the zero value, 126 is the second highest value.

## 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].....

## Can't Assign String Value To Designated Cell

Jun 30, 2013

What am I missing here. The following code fragment

strTestString = In_Wrksht.Range("A" & i)
strNameString = Trim(Mid(strTestString, 6))
Debug.Print strTestString & " uuu"
Debug.Print strNameString & " eee"
In_Wrksht.Range("B" & i) = strNameString & " XXX"
Debug.Print Trim(In_Wrksht.Range("B" & i)) & "ggg"

returns these results:
7/ 31 FIDELITY SHORT TERM BOND uuu
FIDELITY SHORT TERM BOND eee
ggg.

strNameString is not being assigned to B&i. Why Not?

## VBA Slow To Assign A Null String To A Cell - On One Computer Only

Feb 11, 2009

I have a VBA program which is running very slowly on one of my computers, but none of the others.

Here's a piece of code which illustrates the problem, which is that assigning a null string to a cell is very slow.

Option Explicit
Public Sub test()
Dim objSh As Worksheet
Dim I As Integer

Set objSh = Worksheets("Sheet1")
MsgBox "test1"
For I = 1 To 1000
objSh.Cells(1, 1) = ""
Next
MsgBox "test2"
For I = 1 To 1000
objSh.Cells(1, 1) = " "
Next
MsgBox "done"
End Sub

If I change this to assign a space instead it is very fast (about 1,000 times faster).

This slow machine is not normally slow; an ACER Aspire 9410Z with 2GB RAM, running Vista Ultimate.

Other machines run this code OK on a mix of Windows XP, 2000 and Vista Business. with Excel 2003, 2000 and 2007.

Ultimate seems to be the only unique factor of the machine where it runs slowly.

## Assign Specific Cell Value Of Worksheet To A Label

Aug 1, 2006

I am struggling with working with specific cells from specific sheets. e.g.

I want to make a label display teh value of a specific cell.

(i is the row number of the cell i'm interested in)

'now make labellaptime.caption = the cell (i-1, 3) of sheet1(jules)

'LabelLaptime.Caption = i - 1 'works no problem
'LabelLaptime.Caption = Application.Worksheets(Sheet1).Cells(i, 3) 'laptime
'LabelLaptime.Caption = Application.Worksheets(1).Range("i-1,3").Value
'LabelLaptime.Caption = Application.WorksheetFunction.VLookup(
'LabelLaptime.Caption = Range("c3") 'works no problem
'LabelLaptime.Caption = ThisWorkbook.Worksheets.("sheet1").range("c1").value

I've based all this on the book i'm trying to learn from but it doesn't work and (obviously) i don't know why...

(plus any links to info on how to work with specific cells on specific sheets e.g making a variable = to the value of a cell(x,x) of sheet 3)

## Conditional Number Format Based On The Value Of A Specific Cell

May 9, 2009

I have a large spreadsheet which includes many rows whose number format needs to change depending on the value of a specific cell.

So for example:

If cell B20 has value "A", cells Q20:AG20 should display as 1,234
If cell B20 has value "B", cells Q20:AG20 should display as 5.6%
If cell B20 has value "C", cells Q20:AG20 should display as 7.89
Etc...

As conditional formatting does not seem to include a number format option I've worked out that I need some sort of macro to change these settings for me, either automatically whenever the value of B20 changes or, more likely, when I manually choose to run the macro.

## Find Cells With Same Value And Assign A Number To Each

Jun 11, 2009

I use my spreadsheet to keep score during tournaments. when i calculate my leaderboard at the end of the event i list the results first place all the way down until it finishes the list of players. i need to be able find players with the same or equal score and list them as tied for the same place.

another words if i get to the 3rd place and i had 3 players tie for third i need my leaderboard to show them all in 3rd place . currently it would number then 345. i listed below how it should format it. i also attached a file it will make it more clear.

## Generating Random Number String Based On Alphanumeric String?

Aug 14, 2014

Wondering if it is possible to generate a random 4 digit number based off an alphanumeric string?

Example;

Cell A1 has 123XVF1234
Cell A2 has 321AFW4321

In B1 I would like to have a 4-6 digit number that is generated based on the alphanumeric data in Cell A1 (and so on down the list). If that is possible, I would also need to be able to convert back the 4-6 digit number back to its original alphanumeric value

Example;

If B1 returns 643562 it would need to be able to be converted back to 123XVF1234

## Excel 2010 :: Unhiding Specific Number Of Worksheets Based On Cell Value

Jun 26, 2013

I have been attempting to cobble together code from different forums for the past several hours to make a macro to unhide a specific number of worksheets based on a cell value, and have failed miserably thus far. Here are the specifics of what I have going on:

Microsoft Excel 2010
Workbook Name: TASERR Model - 06-26-13.xlsm

In this workbook, I have a worksheet called "Input". In cell C21 of that worksheet, workbook users will fill in a number between 1 and 50 (I have the value for that cell limited to those numbers through data validation). Based on the value in that cell (C21), I want to make a macro to unhide that specific number of hidden worksheets. I have 50 hidden worksheets which are named "Route (1)", "Route (2)", "Route (3)", etc.. If the value in cell C21 is 7, I want the worksheets named "Route (1)", "Route (2)", "Route (3)", "Route (4)", "Route (5)", "Route (6)", and "Route (7)" to unhide. If the value in cell C21 is 3, I want the worksheets named "Route (1)", "Route (2)", and "Route (3)" to unhide. I'm sure y'all can see the functionality I'm going for at this point.

## Returning String From One Cell Based Upon Multiple Cells

May 22, 2013

I need to return the specific text of a cell based upon the text in multiple cells.

Worksheet as follows:

Asphalt Sub:
BLDG1-Backwash 1
*BLDG1*
*Sub*
BLDG1-Backwash 1 OverEx
*BLDG2*
*Sub*

[Code].....

I have three columns thus far. I need to add another column and search all items in Column A using the criteria in Columns B and C. For instance I need to search for BLDG1-Backwash Sub: and place it into column D using the criteria in Columns B and C.

If possible, I would also like to remove both the words, BLDG1 and Sub from the result so then it only shows "Backwash".

My spreadsheet is much larger than this and I have muliple buildings I am dealing with, sometimes 30-40.

## Creating VBA Macro That Changes Specific String To A Number

Jul 7, 2012

I am having some difficulty with a pdf that I converted to an excel document because I wanted to use the data from the pdf tables in a different program I am currently working on. However, the data is in the improper format. For example, in the table it reads 2-1/8 as string and I want it to be the number value 2.125 . Likewise if the value in the table reads 5-1/4 I want it to automatically convert it to something that will be read as the number 5.25

## Assign Dates Based On First Or Last Cells

Feb 27, 2009

1. Start Date (Col. C) - assign date to respective position based on first cell that contains value greater than 0 or "". eg. at first cell with 1 in it, looks up to row 4 and assigns date include in that cell in same column.

2. End Date (Col. D) - assigns date based on last cell with value greater than 0 or ""....

## Putting Specific Value In Blank Cells In Same Row Based On Value In 1st Cell?

Jul 18, 2013

i am trying to Put a specific value i,e "NO Deliveries" in blank Cells in the same row based on value in 1st cell of the Row which has a fixed value . note:the columns and rows are dynamic for example: I want to put the value "no Deliveries" in cell C because its blank.

A B C D

% of Availability
0.00%

80.00%

## Change Current Cell Value If Number String NOT Letter String?

Apr 7, 2014

In sheet1 I have a simple database consisting of 5 columns of data

Column A : Name ie James Jones
Column B : payroll number ie 123456
Column C : shift times ie 1245-2124
Column D : job title ie floor
Column E : comments ie A/L or 0600-1500

what I would like is some code that will go down Column E and if a 'time string' ie 1300-2130 is found then copy this string and paste into corresponding value in column C. If a text string is found ie A/L or Sick or anything like this then ignore and move onto next cell, loop this until all cells in column E have been checked.

## Assign Number To A Cell Depending On Number In That Cell

Mar 8, 2012

Trying to have a formula assign a number to a cell depending on a number in that cell.

Example

In all cells in a range from C8 to G13, if there is a 1, i want the number in C20 to show, if there is a 2, whats in

D20, 3/E20, 4/F20, 5/G20, 6/H20

## Populate A Specific Range Of Cells Based On A Value Of Any Kind In A Header Cell

Sep 22, 2009

I need to populated a specific range of cells based on a value of any kind in a header cell. Attached is a sample of the end results. Please remember each header cells needs to determine what happens the range of cells below the header cells.

## Extracting Specific String From All Cells?

Oct 25, 2012

How does one extract a specific sting/words from each cell? Especially if [formatted data] varys in characters (not suitable for regular LEFT, MID, RIGHT functions use).

Sample Question.xlsx

## Copy Entire Row If Cells In Row Contains Specific String

Apr 3, 2013

I'm trying to copy entire row from sheet "source" to sheet "output".

Condition: If cell or cells in range (E7: lastcoll, lastrow) value is "A" then copy entire row.

Find the excel template in attachment.

My problem is that my macro is copying particular row, as many times as many "A" finds.

I want to copy entire row just once doesn't matter how many cells with "A" are in particular row.

VB:
'function to find last column a change letter of column to number
Private Function ColLetter(LastCol)
End Function

[Code] .....

copyROW.xlsm

## 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.

## 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.

## 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.

## 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.

## Identifying Cells With Specific Format Pattern Within String

Oct 30, 2013

I have a list of 10k cells with Peoples names in various formats (Title,First name,initials,Surname etc and variations).

I am trying to identify the cells that have within the string the following : 'space','UpperCase Char','LowerCase Char','space' (eg Prof " Dc " Jones).

I need to then change the lowercase char to uppercase.

## Minus Number From Cell And Result In Specific Cell And Specific Column

Jan 20, 2009

I have number in cell (A1) = 100. when I enter number in any cell of column(B) for example (B1)=10. then in cell (C1) the result of (A1) - (B1) = (90) and if I add in cell (B2)=10 then in cell (C1) the result of (A1) - (B1+B2) = 80 .accumulatively in cell (C1). and any number in column (B), the result will be (A1) minus any number in column(B) accumulated in (C1)

second question

I have number in cell (A1) = 100. when I enter number at cell (B1) = 10 then the result would be in the adjacent cell (C1) = (A1) - ( B1) = 90 and If I enter a new number in cell (B2) = 10 then the result would be in the adjacent cell (C2) = (A1) - (B1+B2) = 80 and If I enter a new number in cell (B3) = 10 then the result would be in the adjacent cell (C3) = (A1) - (B1+B2+B3) = 70 and so on. I want the result to be add automatically to adjacent cell in column (C)

## 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

## 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.