If statement with multiple variables

  • Thread starter Thread starter Legacy 93538
  • Start date Start date
L

Legacy 93538

Guest
Hi

Does anyone know whether its possible with an if statement to say if the cell value is like "*Gross" but does not contain "Total New", "Total Used" or "Sub-Total"?

As i need to create an if statement which looks at a cell value and if it contains "gross" then put "gross" in the cell of another sheet but if it contains Gross and one of the following "Total New", "Total Used" or "Sub-Total" then ignore it

Thanks

Jessicaseymour
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Not very elegant, but this seems to work.

Code:
=IF(AND(ISERROR(FIND("Total New",A1,1)),
ISERROR(FIND("Total Used",A1,1)),ISERROR(FIND("Sub-Total",A1,1))),
IF(ISERROR(FIND("Gross",A1,1)),"","Gross"),"")

Note, the FIND() function is case sensitive. If that's a problem, try SEARCH() instead.
 
Upvote 0
Hi

Thanks for replying!

Now i know its possible i should provide more detail.

The If statement will go inside a loop which loops through the cell range F4:U640 on the WB variable PPFWB.Sheets("IRFORM") and then has two if statements one to check if the cell is empty, if it hasn't it should then complete the if statment you created.

The sheet it needs to paste value in is a variable called PPCWBSht. the code i use to place the value in that sheet is
Rich (BB code):
PPCWBSht.Cells(NRow, 4).Value =

This is what i have so far but i am not sure how i would interrogate your code.

Rich (BB code):
NRow = 2
Application.StatusBar = "Loop through calcs Form and populate calculations table"
For Each cell In PPFWB.Sheets("IRFORM").Range("F4:U640")
    If cell.Value <> "" Then
         <  IF(AND(ISERROR(FIND("Total New",A1,1)),
ISERROR(FIND("Total Used",A1,1)),ISERROR(FIND("Sub-Total",A1,1))),
IF(ISERROR(FIND("Gross",A1,1)),"","Gross"),"") >
       End If
            NRow = NRow + 1
            Application.StatusBar = cell.Address
    End If
Next cell
 
Upvote 0
Sorry I'm not a VBA expert.
I'm sure there will be a way of handling the logic I coded into that formula, in VBA, but I'm not the best person to give you that.

Anyone else ?
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,795
Members
452,943
Latest member
Newbie4296

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