ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macros & search /replace (https://www.excelbanter.com/excel-worksheet-functions/71173-macros-search-replace.html)

Anthony

Macros & search /replace
 
Use a macro to convert data files imported as CSV files into the correct
format for importation into another program.
Column A contains words COW, BULL, STEER,HEIFER

Need to add to my macro a formula that will examine column A and insert in
adjacent cell column G a "M" if the Column A cell contains Bull, "F" if the
A Cell contains COW or HEIFER; and "C" if it contains Steers

Any help greatly appreciated

thanks

Roger Govier

Macros & search /replace
 
Hi Anthony
Try
=IF(A1="","",IF(OR(A1="HEIFER",A1="COW"),"F",IF(A1 ="BULL","M","C")))


--
Regards

Roger Govier


Anthony wrote
Use a macro to convert data files imported as CSV files into the
correct format for importation into another program.
Column A contains words COW, BULL, STEER,HEIFER
Need to add to my macro a formula that will examine column A and
insert in adjacent cell column G a "M" if the Column A cell
contains Bull, "F" if the A Cell contains COW or HEIFER; and "C" if
it contains Steers Any help greatly appreciated
thanks






JE McGimpsey

Macros & search /replace
 
One way:

G1: =LOOKUP(A1,{"BULL","COW","HEIFER","STEER"},{"M","F ","F","C"})


In article ,
"Anthony" wrote:

Use a macro to convert data files imported as CSV files into the correct
format for importation into another program.
Column A contains words COW, BULL, STEER,HEIFER

Need to add to my macro a formula that will examine column A and insert in
adjacent cell column G a "M" if the Column A cell contains Bull, "F" if the
A Cell contains COW or HEIFER; and "C" if it contains Steers

Any help greatly appreciated

thanks



All times are GMT +1. The time now is 02:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com