If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Question regarding INDRIECT function

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-05-11, 12:22
mike703 mike703 is offline
Registered User
 
Join Date: Mar 2005
Posts: 23
Question regarding INDRIECT function

Hello All,

I am building a report in which I have started to get familiar with the INDIRECT funtion. Was not having much trouble with it until I ran into the following formula:

=SUM(IF('SAL Adjusted'!$AN$3:$AN$314<'SAL Adjusted'!$AP$3:$AP$314,1,0)

I tried to apply the same syntax that I had applied to the other lines of formula that worked but the following quickly produces an error:

=SUM(IF(INDIRECT("'SAL Adjusted'!$AN$3:$AN$314")<(INDIRECT("'SAL Adjusted'!$AP$3:$AP$314"),1,0)))

Im sure my syntax is off somewhere, but not sure where exactly. Have tried a few different placements of the end quote and parenthesis, but have not gotten the above formula to work. Any help would be greatly appreciated!
Reply With Quote
  #2 (permalink)  
Old 04-05-11, 15:11
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
Hi,

You got your brackets a bit muddled up; this formula is (of course) an array formula so must be completed with CTRL+SHIFT+ENTER:
Code:
=SUM(IF(INDIRECT("'SAL Adjusted'!$AN$3:$AN$314")
    <INDIRECT("'SAL Adjusted'!$AP$3:$AP$314"),1,0))
You might prefer the SUMPRODUCT() equivalent which doesn't need to be CTRL+SHIFT+ENTER'd:
Code:
=SUMPRODUCT(--(INDIRECT("'SAL Adjusted'!$AN$3:$AN$314")
    <INDIRECT("'SAL Adjusted'!$AP$3:$AP$314")))
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #3 (permalink)  
Old 04-05-11, 15:34
mike703 mike703 is offline
Registered User
 
Join Date: Mar 2005
Posts: 23
Colin...once again, you are the man!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On