How to use OR formula in Excel correctly? With IF and LEFT

Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
445
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi all,

I am currently trying out this formula:

1661521328209.png


Copy of my formula: =if(A5=Left(A5;5)="Bob G"OR(A5=Left(A5;5)="George G");"This formula works!";"This formula does not work!")

Essentially, what I want to achieve is for my formula to return "This formula works!" if the value in cell A5 is EITHER = "Bob G" OR "George G" and then return "This formula does not work!" when the value is equal to Donald X and George X or essentially any other value at all :-)

However, my formula does not work at the moment and it gives me an error. I have never used OR before in a formula, so I think I may have this messed this one up?

Can somebody please help me?

THank you! :)
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
How about
Excel Formula:
=if(or(A5={"Bob G";"George G"});"This formula works!";"This formula does not work!")
 
Upvote 0
How about
Excel Formula:
=if(or(A5={"Bob G";"George G"});"This formula works!";"This formula does not work!")
This is amazing! Thank you so much Fluff!

I would really like to somehow implement a LEFT function in this, so it says whether the first 5 characters = "Bob G" or the first 8 characters = "George G", if that makes sense?

In my real data it is much more messy and some of it goes as follows for example...

George G 57328432832
George G 3228383
Bob G 532983
Bob G 483

George X 7432
Bob X 7353
George G 52

So I need to somehow make it count the bold ones as important, while ignoring those that do not have values of George G or Bob G in the first 5 or 8 characters, if that makes sense?
 
Upvote 0
Ok, how about
Excel Formula:
=if(or(left(a5;5)="Bob G";left(a5;8)="George G");"This formula works!";"This formula does not work!")
 
Upvote 0
Solution
Ok, how about
Excel Formula:
=if(or(left(a5;5)="Bob G";left(a5;8)="George G");"This formula works!";"This formula does not work!")
This works!

Incredible! Thank you so very much Fluff! I hope you have an amazing weekend :)

Kind regards,
Jyggalag
 
Upvote 0

Forum statistics

Threads
1,224,753
Messages
6,180,747
Members
452,996
Latest member
nelsonsix66

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