# If cell contains text then calculate - What is the formula?

#### NNOG28

##### New Member
 column/row A B C D 1 Item Unit or pallet unit per case Total Case 2 Apple 50 2 25 (=50/2) 3 Apple on a pallet 4 2 8 (=4*2) 4 Orange 8 4 2 (=8/4) 5 Orange on a pallet 15 4 60 (=15*4)

<tbody>
</tbody>

I want to use if formula to calculate for column D. what should the formula be?

I tried this but it didn't work.

=IF(A2="*"&"pallet"&"*",B2*C2,B2/C2)

### Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

#### Fluff

##### MrExcel MVP, Moderator
=IF(ISNUMBER(SEARCH("pallet",A2)),B2*C2,B2/C2)

#### James006

##### Well-known Member
Hello,

When it comes to designing your worksheet ...

You should make your life easier ...and have nothing but Apples and Oranges in your Items Column ...

and insert a Type Column ... with say P for Pallet and nothing for Unit ...

HTH

#### DanteAmor

##### Well-known Member
Try:

=IFERROR(VLOOKUP("*pallet*",A2:B2,2,0)*C2,B2/C2)

#### NNOG28

##### New Member

=IF(ISNUMBER(SEARCH("pallet",A2)),B2*C2,B2/C2)

This works perfectly for me.. thank you so much

#### NNOG28

##### New Member
Hello,

When it comes to designing your worksheet ...

You should make your life easier ...and have nothing but Apples and Oranges in your Items Column ...

and insert a Type Column ... with say P for Pallet and nothing for Unit ...

HTH

This is a good idea to try to make it simpler when it comes to our own spreadsheet! however, it is a task that happen repetitively every week, so I want to try to have it formulated for saving time.

thank you.

#### Fluff

##### MrExcel MVP, Moderator
This works perfectly for me.. thank you so much

You're welcome & thanks for the feedback

Replies
14
Views
189
Replies
0
Views
31
Replies
3
Views
75
Replies
7
Views
81
Replies
2
Views
37