I use the following function to count the number of days present:
=COUNTIF(C2:T2,"=P")
It works great in cell U2.
Now I want to use Address function instead, to select the previous cell instead of T2:
=COUNTIF(C2:INDIRECT(ADDRESS(INDIRECT(ROW(CELL("address")))-1,
INDIRECT(COLUMN(CELL("address")))-1)),"=p")
It is not working ;(
Please, help.
Indirect and Address can probably be replaced with a simple Index.
How about
=COUNTIF(C2:Index(2:2,column()-2,"=P")
In words: perform a countif on the range from C2 to the cell in row 2 that is 2 columns to the left of the current column.
If that does not answer your question, please edit it and explain the logic in similar words.
Related
I need a suggestion for regular formula (no VBA/no array formulas) to do the following please:
There is the following dataset:
I need a formula going in the column A and B and returning the month of the first and the second change from 1 to 2 for each row correspondingly.
There are only 1 and 2 being used in the searchable range.
This was really a puzzle :) Please find solution W/O array formula. Make sure you put a number 1 and 2 in cells A1 and B1, because they are part of formula telling which occurrence to take.
=IFERROR(INDEX($E$1:$P$1,1,AGGREGATE(15,6,(COLUMN($E$1:$P$1)-COLUMN($E$1)+1)/($E2:$P2/$D2:$O2=2),A$1)),"")
Without array formulas and pre-calculcations it is very awkward solution
https://drive.google.com/open?id=0B44mzqKXfJYobjNuc0xQRHBaZVU
Use this file for your task. (formulas are inside)
Thank you for + my answer
What is the best function to get a cell from the same row as another cell on a separate sheet. On sheet 1, A2 is a lead id and B2 is a name. On sheet 2, if I put in the lead id on A2, I want the name to autopopulate in B2. The function I used is =IF(A2=Leads!A:A,Leads!B:B," ") Now, it works fine with my first two leads but then it returns the false value on all the others. It has worked a couple times but it seems really glitchy. Any better way to accomplish this?
I think you should be able to use a vlookup function for this. Try putting the following formula into Sheet2 cell B2:
=VLOOKUP(A2,Sheet1!A:B,2,FALSE)
vlookup will work (Chris Moore answered with this)
Personally I prefer using index/match because if you alter the structure of the sheet by inserting or removing columns the formula adapts better and also because index match can lookup columns in any order and uses more precise ranges
=INDEX(Sheet1!B:B,MATCH(Sheet2!A2,Sheet1!A:A,0))
For a more in-depth explanation there is one here: https://www.deskbright.com/excel/using-index-match/
As in title, I'm trying to compare two lists and when a formula hits the match I want it to type the text, but from the cell right next to the found matching cell.
For example: A list of 5343 positions B1:B5343 has corresponding reference numbers in A column (A1:A5343). F1 has a certain number. G1 ought to show the reference number, not the match itself.
I've tried to work with this formula:
=IF(ISERROR(MATCH(F1;$B$1:$B$5343;0));"";A1)
Where A1 should be the reference cell. Not fluent in Excel enough to know
is there a way to refer to a formula result?
is it possible to refer to a cell next to the cell of interest (or few away)? ex.(B-1)54=A54
Not sure how can I clarify the problem more than that :) Help me out please!
Eager to read Your answers! Cheers!
This is a typical case for Vlookup
i would probably go for a index match on this, so INDEX(C:C,MATCH(F1,B:B,0),1)
the index part will go get the cell next to it you want, just replace C:C with the column its in
If its not a match use iferror, rather than iserror as well, Its better practice.
SO : IFERROR( INDEX(C:C,MATCH(F1,B:B,0),1) ,"NO MATCH)
Heres a tutorial
I have a table of my workdays and I want to count instances of word 'work' in each row.
I have a table like this:
I used this code in J1 cell but it doesn't work.
=SUM(IF(2:2 = "Sleep",1,0))
I have found this formula in microsoft's website but it doesn't work.
What is causing this problem?
You need to use the COUNTIF function.
=COUNTIF(C2:I2,"Sleep")
This goes in Cell J2
From Excel's Help
The COUNTIF function counts the number of cells within a range that meet a single criterion that you specify. For example, you can count all the cells that start with a certain letter, or you can count all the cells that contain a number that is larger or smaller than a number you specify.
When in doubt, press the magic button F1 in Excel. :)
Just came across a similar thing in a worksheet and came to google before I remembered why it didn't work.
The countif statement above is perfectly fine, however the original formula given wouldn't have worked as to use a sum in this way means you have to make it an array or CSE Formula instead.
So, if you come across this, click in the formula bar and press ctrl + shift + enter and it should sort the whole thing out.
I did try to enter in a cell formula:
=SUM(ADDRESS(ROW(),COLUMN()+1):ADDRESS(ROW(),COLUMN()+2))
Intention is summing next 2 cell in the same row.
But the spreadsheet complains with error on it!
Used functions: ADDRESS(ROW(),COLUMN()+1). Work fine but together - not!
In B7 cell:
(I need to write a generic formula that is independent from location and calculates the sum of the next tho cell in the same row.
I am not interested in specific addresses or in a way to copy any specifically written formula across a spreadsheet.
I need a formula that works independently from a location!
Is it possible in Excel at all?)
Thanks.
ADDRESS returns address as a string. You cannot SUM it because SUM(A2:A3) is very different from SUM("A2:A3").
You could look into SUM(INDIRECT("A2:A3")), but you should not, for the mere reason that Excel's formulas are already relative unless made absolute.
If you want to sum two cells to the right of B7, enter =SUM(C7:D7) to B7. The formula will change if you copy it to another cell.
If you meant to enter the formula with a macro, then use the R1C1 notation and enter =SUM(RC[1]:RC[2]).
sorry im dont speak english , but a have what you need
= SUM(INDIRECT(CONCATENATE(ADDRESS(ROW();COLUMN()+1);":"; ADDRESS(ROW();COLUMN()+2))))
Regards