if formula

M

MSKC LLC

i need a formula that will do the following function: If A1 equals either
D/S, Sunday, or Daily and write 16.84 for D/S, 8.48 for Sunday, 8.06 for Daily
 
P

Per Jessen

Hi

Try this:

=IF(A1="D/S",16.84,IF(A1="Sunday",8.48,IF(A1="Daily",8.06,"")))

Regards,
Per
 
D

Dennis Tucker

This could be done using nested "if" functions, but it get long and messy.

It would be better to write a custom Excel worksheet function instead.
1. Open the VB editor.
2. Add a code module to the workbook.
3. write the following function;

Function MyConverter(InputValue as string) as single

Select Case InputValue
Case "D/S"
MyConverter=16.84
Case "Sunday"
MyConverter=8.48
Case "Daily"
MyConverter=8.06
End Select

End Function

4. Now in a cell like B1 enter the function call

=MyConverter(A1)

B1 should convert from cell A1.



Dennis
 

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

Similar Threads


Top