You are here:

Excel/Using cell content in if statement


QUESTION: Hi Expert,

I am using if statement as =IF(H2<Sheet2!$B$2,Sheet2!$A$2,0)

instead of address $B$2 , i want to put a formula that pick address of cell stored at B2

e.g : B2 contains A1 ( coming from some formula)

then formula should become like

please suggest some way out.

ANSWER: INDIRECT() allows you to construct references from text strings.

  =IF(H2<INDIRECT("Sheet2!" & B2), Sheet2!$A$2, 0)

---------- FOLLOW-UP ----------

QUESTION: I believe this should be

=IF(H2<INDIRECT("Sheet2!" & "B2"), Sheet2!$A$2, 0)

That is incorrect based on your original question.

If cell B2 of the current sheet had a text reference of "Z10" written in it, then my formula would translate to "Sheet2!Z10".

Your would always just translate to Sheet2!B2 and never change regardless of what you put in the local cell's B2.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Jerry Beaucaire


Excel Formulas, macros, automation. Microsoft Excel MVP - 2010. Code site with free code snippets and techniques:


Microsoft Excel MVP - 2010. I have my own extensive Excel help/code site: ===================== I have been offering free assistance as an Excel aid on many web sites for many years: ( - JBeaucaire) ======== ( - JBeaucaire) ======= ( - jbeaucaire)

Bachelor's Degree from Azusa Pacific University in Mathematics and Music Composition

Awards and Honors
Microsoft Excel MVP 2010

©2016 All rights reserved.