If Statement with multiple criteria + Concatenate Function

WantToMasterExcel

New Member
Joined
Feb 10, 2012
Messages
20
Employee IDFundProperty General ExpenseExpense DescriptionVBA Coded Needed in this Column
JKCPCPCORP March Misc ExpJK - cell phone BillJK - cell phone Bill
LTCPCPCORP Property VisitsLT - taxi from airport to hotelLT - taxi from airport to hotel
SNDCUIDCUI-Fund SN - travel agent feeSN - booking feeSN DCHI DCHUI-Fund SN - travel agent fee
ANCPCPCORP AN - Tours in DCAN - airfare to SeattleAN - airfare to Seattle
RBDCUIDCUI-Fund RB - Museum Tower visitRB - taxi from NOBE tour to hotelRB DCUI DCUI-Fund RB - Museum Tower visit
OSCPCPCORP OS - Meal - SelfOS - Lunch with Donna GaylesOS - Lunch with Donna Gayles
TRRCSRCS-Fund TR - RealShare conference registrationTR - Diverse Investor ForumTR RCS RCS-Fund TR - Real Share conference registration
LMDCUINORE LM - data planLM - PersonalLM - Personal
FWFRCAFRCA Corp FW - ISC conference registrationFW - Spring ConferenceFW FRCA FRCA Corp FW - ISC conference registration
HTTRSILVictor Attending the ConferenceHT - hotel in HoustonHT TRSIL Victor Attending the Conference
DSGALERTower1 DS - BreakfastDS - Dinner w/ VIPsDS GALER Tower1 DS - Breakfast
Required VBA in COLUMN "F":
If the text in Column B is CPCP and the text in column C is Corp, Then Return or copy the value from Column E to Column F
If the text in Column B is DCUI and the text in column C is NORE, Then Return or copy the value from Column E to Column F
For the REST of the Value in Columns B & C, apply CONCATENATE Function(Return the value in Column "F" = Column A "Employee ID" + Column B "Fund" + Column C "Property" + Column D "General Expense"
Also, there are hundreds of ROWS in this Sheet named "Sheet1". Therefore, I need vba to perform till the end of the Last ROW

<tbody>
</tbody>
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Any VB Maestro out there to Help me out here please. I need it tonight to submit this project, in order to be considered for a job. PLEASE HELP !!!!!!
 
Upvote 0
I guess the lack of response may be due to the VBA requirement. You don't need VBA.

Enter in cell F2 and copy down:

Code:
=IF(OR(B2&C2="CPCPCORP",B2&C2="DCUINORE"),E2,A2&" "&B2&" "&C2&" "&D2)
 
Upvote 0
Marcel,
I do need a VBA for this formula you just provided =IF(OR(B2&C2="CPCPCORP",B2&C2="DCUINORE"),E2,A2&" "&B2&" "&C2&" "&D2). Thanks a lot for your response
I guess the lack of response may be due to the VBA requirement. You don't need VBA.

Enter in cell F2 and copy down:

Code:
=IF(OR(B2&C2="CPCPCORP",B2&C2="DCUINORE"),E2,A2&" "&B2&" "&C2&" "&D2)
 
Upvote 0
Marcel,
I do need a VBA for this formula you just provided =IF(OR(B2&C2="CPCPCORP",B2&C2="DCUINORE"),E2,A2&" "&B2&" "&C2&" "&D2). Thanks a lot for your response

You're welcome, but can you please explain why you would need VBA?
I can think of either you would regard a formula as being VBA (which it is not), or you might not be aware that formulas are auto-adjusted to the applicable row if you copy it downwards. Or something else I can't think of :confused:.

E.g. if you copy the formula in F2 downwards to F3, in F3 it will read automatically:
Code:
=IF(OR(B3&C3="CPCPCORP",B3&C3="DCUINORE"),E3,A3&" "&B3&" "&C3&" "&D3)

Alternatives to copy formulas downwards to all rows of data (let's say F2:F300):
1. Enter the formula in cell F2 and double click the lower right corner of the cell. This requires all non-empty cells in E2:E300.
2. Enter the formula in F2, select range F2:F300 and press CTRL d.
3. First select range F2:F300, than enter your formula and confirm it with CTRL-ENTER (not CTRL-SHIFT-ENTER).

Thanks,
Marcel
 
Upvote 0
Sir,
I am creating a macro to automate a monthly expense( a project to provide to my new TO BE Boss, if they are satisfied , they will hire me) I understand, I can pull the plus sign all the way downwards in that column and it will automatically copy the formula. I know basic macros, copy paste, select, cut paste, etc. AS it gets complicated, I sort of lose my mind, as I am just an Excel user not an expert on Macros/VBA.
Thanks again
 
Upvote 0
OK. Here is the macro now. I am getting "Application-defined or Object Defined error". ANYONE here please:

Sub Zacro()
' Zacro Macro

Dim LR As Range

With Sheets("Sheet1")
Set LR = .Cells(.Rows.Count, "A").End(xlUp)
.Range("F2:F" & LR.Row).Formula = "= IF(OR(B2&C2=CPCPCORP, B2&C2=DCUINORE),E2,A2&""& B2& ""&
C2&""& D2)"
End With


End Sub

Thanks.

You're welcome, but can you please explain why you would need VBA?
I can think of either you would regard a formula as being VBA (which it is not), or you might not be aware that formulas are auto-adjusted to the applicable row if you copy it downwards. Or something else I can't think of :confused:.

E.g. if you copy the formula in F2 downwards to F3, in F3 it will read automatically:
Code:
=IF(OR(B3&C3="CPCPCORP",B3&C3="DCUINORE"),E3,A3&" "&B3&" "&C3&" "&D3)

Alternatives to copy formulas downwards to all rows of data (let's say F2:F300):
1. Enter the formula in cell F2 and double click the lower right corner of the cell. This requires all non-empty cells in E2:E300.
2. Enter the formula in F2, select range F2:F300 and press CTRL d.
3. First select range F2:F300, than enter your formula and confirm it with CTRL-ENTER (not CTRL-SHIFT-ENTER).

Thanks,
Marcel
 
Upvote 0
Hi,

Well, I'm not a VBA expert, but I see there are no quotes around CPCPCORP and DCUINORE.
 
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,309
Members
449,080
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top