Why is this not working?

Aitch

Board Regular
Joined
Jan 27, 2019
Messages
119
Office Version
  1. 2010
Platform
  1. Windows
Hi! I just can't figure this one out so hope someone here can help!


This straightforward formula works fine:

=COUNTIF( INDIRECT( "Z" & L10 & ":Z" &M10),"=1")


I want to replace the "Z" part with this formula that automatically finds the column - SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","")


So shouldn't it look like this?

=COUNTIF( INDIRECT( SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","") & L10 & :SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","") &M10),"=1")


But I keep getting errors - am I missing a "" or ) somewhere?


Thanks!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
See if this works for you:
=COUNTIF(OFFSET(INDEX($A:$IV,,COLUMN()),$L10-1,,$M10-$L10),1)

You can add more columns past IV if you need to.
 
Last edited:
Upvote 0
How does it not work? It seems to do what you are trying to do. Otherwise please explain what you are trying to accomplish.



Excel 2010
LMNOP
121
2
3
4
5
6
7
8
9
10101514
1134
1224
1311
1497
1597
Sheet1
Cell Formulas
RangeFormula
O1=COUNTIF(OFFSET(INDEX($A:$IV,,COLUMN()),$L10-1,,$M10-$L10),1)
P1=COUNTIF(OFFSET(INDEX($A:$IV,,COLUMN()),$L10-1,,$M10-$L10),1)
 
Last edited:
Upvote 0
Sorry! I made a mistake with my original post - L10 should be L10+1

=COUNTIF( INDIRECT(
"Z" & (L10+1) & ":Z" &M10),"=1")


I've amended your formula and think it's working perfectly now! I just removed the -1 from $L10-1

Would you mind checking I've done it correctly please?

=COUNTIF(OFFSET(INDEX($A:$IV,,COLUMN()),$L10,,$M10-$L10),1)


Thank you so much bro!
 
Upvote 0
Hi Scott, could you help me out again please!

I've modified your formula with the SUM function:

=SUM(OFFSET(INDEX($A:$IV,,COLUMN()),$L10,,$M10-$L10),1)

It calculates perfectly - but for some reason the value it creates is not affected by Conditional Formatting?

I'm using a rule that turns the font red if the value is negative - but the SUM value stays the same colour...

What am I doing wrong?
 
Upvote 0
It worked fine for me. What is your Conditional Formatting setting?
 
Upvote 0
Let me look at it again - I'm using a simple rule A1:A less than 0


Also, the formula above for finding the column letter =SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","")

How can I "add" to this so that it increases the column letter?

I mean, when I put the formula in cell A1, it gives value "A" - so in cell B1, how can I calculate A1+3 to give value "D"

 
Upvote 0
Why don't you just select the cell range and use a condition of Cell Value is less than 0

It usually isn't necessary to build an address from a text string. What is the purpose of that formula?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,624
Members
449,240
Latest member
lynnfromHGT

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