0

? is a special character in excel, and as far as I'm aware, won't work with =FIND("?",<stringref>)

=FIND(CHAR(63),<stringref>) returns what I want. In my case it's 11, because the ? character appears first, 11 characters along my string.

Now, I want CHAR(63) to be referenced from another cell in the formula, NOT hard coded.

So let's say cell A1 has my formula, and A1 has my search item, ? or CHAR(63).

How do I reference ? or CHAR(63) from my formula in cell A1 to return the number of characters along my string (in C1)?

Here's my attempt:

=CODE("?") produces "63", so in theory I could use that.

A1 = FIND(B1,C1) = Value Error
B1 = CONCATENATE("CHAR(",CODE("?"),")") = CHAR(63)
C1 = somestring?someparam

I want: A1 = 11

The problem seems to be referencing the string CHAR(63) in another cell, because it works if I embed the formula of B1 into A1.

square_eyes
  • 1,269
  • 3
  • 22
  • 52

1 Answers1

1

You don't need to do all that jazz in cell B1. Just put ? in B1 (with no quotes and no equal sign) and then use the formula,

 =FIND(B1,C1) 

in Cell A1.

Note that if you are trying to conceptually figure out how to put "CHAR(63)" into Cell B1 and then have it evaluate this function when using it as an input to the "Find" function, then you would have to use some VBA, such as here.

Additionally, you could put "=code("?")" into cell B1 and then use:

=FIND(CHAR(B1),C1)

in cell A1.

Community
  • 1
  • 1
OpiesDad
  • 3,385
  • 2
  • 16
  • 31
  • Yes I seem to have gone on a tangent and missed this. You are right. I think my top rows of data had no ? hence the failing. When I fill to something with a ? it returns correct:) - Could have saved myself an hour of going down the rabbit hole. – square_eyes Jan 28 '16 at 00:01
  • I just tested your original premise of "=FIND("?", )" and that also worked for me in Excel 2013. Perhaps it doesn't work in earlier versions – OpiesDad Jan 28 '16 at 00:05