If Then ?

J

Jermert

Is it possible to assign a currancy value to a cell based upon the text
string in another cell?
 
T

Tom Ogilvy

Using a macro - but not with a formula.

You can also look at the Text worksheet function.
 
J

Jermert

Perhaps I should be more explicit; I have a simple invoice with pull down
boxes in the service description area, these are common items we charge for,
the rates for these items is also consistant. What I would like to do is auto
fill the Cost @ depending on the pull down item selected. Thanks
 
D

Dan R.

Here's an example:

Sub Test()
For Each Cell In ActiveSheet.Range("B1:B2")
If Cell.Value = "Test" Then
Cell.Offset(0, -1) = Format(Cell.Offset(0, -1), "$0.00")
End If
Next Cell
End Sub
 
D

Dan R.

This is probably more what you're looking for. Put this code behind
the sheet, not in a module.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Long
R = Target.Row
If Target.Column = 1 Then
Select Case Cells(R, 1)
Case Is = "Oil Change": Cells(R, 2) = "14.95"
Case Is = "Tune Up": Cells(R, 2) = "59.95"
'Case Else
End Select
End If
End Sub
 
T

Tom Ogilvy

I would assume you have a lookup table in the workbook where you have a row
with the item identifier (from the dropdown) in the left most column and the
price next to it. then you would use Vlookup

Assume

the lookup table is in a sheet named DataSheetName with the identifiers in
column A and the prices in column B.

the dropdown is in B2 of another sheet (Invoice sheet)

in C2 of that sheet as an example
=if(B2="","",Vlookup(B2,DataSheetName!A:B,2,false))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top