Super Easy - But I don't understand what I'm missing

CraiginColorado

New Member
Joined
Nov 21, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I am trying to figure out this basic Excel formula. What I am not seeing?
I started with a long formula, and weeded down to just this simple formula and my computer just to make sure I'm doing stuff correctly.
It is just not giving me the correct answer.
My end goal was I am trying to find out when a number 1 and 4 are side-by-side, or, when a number 4 and 1 are side by side.
I can't even get it to work on just this simple formula: IF(MID(B13,2,1)>=1,"YES","NO")
Cell B13 thru B22 is just random test numbers.
Cell C13 thru C22 is the result that will never switch from Yes.
Cell E13 thru E22 is the formula for cells C13 thru C22 without the equal.
Why isn't it ever toggling to NO?
I have shutdown Excel 3 times, and have rebooted my computer too.
 

Attachments

  • Excel - If - Then.png
    Excel - If - Then.png
    18.1 KB · Views: 8

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi, welcome to the forum!

The MID() function always returns text which you are then comparing to a number. In Excel, any text is always greater than any number.

One way to compare like for like would be to wrap the 1 in quotes to make it text.

Excel Formula:
=IF(MID(B13,2,1)>="1","Yes","No")
 
Upvote 0
MID(B13,2,1) is a text string, 1 is a number... you cannot compare them. Try adding 0 to the MID function to convert it to a real number and then it should work correctly for you...

IF(0+MID(B13,2,1)>=1,"YES","NO")
 
Upvote 0
My end goal was I am trying to find out when a number 1 and 4 are side-by-side, or, when a number 4 and 1 are side by side.

Maybe..
Book1
ABC
13111No
14222No
150No
16765No
1711411Yes
18411415Yes
191234541564Yes
20104No
Sheet1
Cell Formulas
RangeFormula
C13:C20C13=IF(COUNT(XMATCH({14,41},MID(B13,SEQUENCE(,LEN(B13)),2)+0)),"Yes","No")
 
Upvote 0
Solution
Seeing what @FormR replied to, here is a single formula that will generate all of values you seek...
Excel Formula:
=IF(BYROW(IFERROR(FIND({14,41},B13:B20),0),SUM),"YES","NO")
 
Upvote 0
Wow!
Thanks a lot guys....
I haven't done Excel stuff in 30 years but I was inspired by searching for a way to change to a different
base format (base 4). Google located the information on this forum "mrexcel" and the info got me
on the correct path. I only have two more formula I need to figure out, then I think my data sheet will
actually work.
My car forum will love it!
 
Upvote 0
MID(B13,2,1) is a text string, 1 is a number... you cannot compare them. Try adding 0 to the MID function to convert it to a real number and then it should work correctly for you...

IF(0+MID(B13,2,1)>=1,"YES","NO")
I am seeing how each of these formulas works, just to gain my knowledge.
For this one I'm getting a #VALUE! error for the digits of 0 (B15), 1 (B21), 2 (B22).
Just curious why that would be showing?
 
Upvote 0
Seeing what @FormR replied to, here is a single formula that will generate all of values you seek...
IF(BYROW(IFERROR(FIND({14,41},B13:B20),0),SUM),"YES","NO")
I like the way yours, and FormR did the two formula.
I am going to play with each just to see how they work, just so I understand them both.
I am going to mark this thread as Solved, mainly because yours was the last input. (Not sure if I can mark FormR answer too).
 
Upvote 0

Forum statistics

Threads
1,225,382
Messages
6,184,640
Members
453,248
Latest member
levi_15

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