0

I am trying to put a text function inside another function (if statement) in excel:

=IF(C1 <> 0, ="INSERT INTO [dbo].[GPI_ASOC] ([GPI],[THER_CLASS_DESC],[GENERIC_NAME]) VALUES ('" & TEXT(A1,0) & "', '" & TEXT(C1,0)  & "',  '" & TEXT(D1,0) & "');", "FAIL")

If C row# <> 0 make the field say FAIL if not make the cell show the insert statement.

Edit: does not = 0 (<>)

5
  • In Excel, the syntax for "does not equal" is <> instead of != Commented Jan 26, 2017 at 19:32
  • @tigeravatar ok thanks ill update Commented Jan 26, 2017 at 19:32
  • 1
    Remove the = before "Insert... Commented Jan 26, 2017 at 19:33
  • @ScottCraner Well, now I feel silly. I didn't realize it would evaluate without telling excel its a function. Commented Jan 26, 2017 at 19:34
  • 1
    You did tell Excel it was a function with the first = all others are assumed. Commented Jan 26, 2017 at 19:36

1 Answer 1

1

Try this:

=IF(C1 <> 0, "INSERT INTO [dbo].[GPI_ASOC] ([GPI],[THER_CLASS_DESC],[GENERIC_NAME]) VALUES ('" & TEXT(A1,0) & "', '" & TEXT(C1,0)  & "',  '" & TEXT(D1,0) & "');", "FAIL")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.