Pass a changable named range as formula argument - excel

I have a formula that checks data on another sheet that is part of a set of sheets that are calendars for given years (2019, 2020,...).
In this formula I check the number of workingdays like this:
=NETWORKDAYS(A28;EOMONTH(A28;0);INDIRECT(B28& "!B58:D73"))
where B28 is the year I want to check.
No I need a small change as I have a named range Holidays_Vacations_yyyy where yyyy is the year. This way the formula should be something like
=NETWORKDAYS(A28;EOMONTH(A28;0);INDIRECT("Holidays_Vacations_" & B28))
This way, when B28 is 2019, the formula should check named range Holidays_Vacations_2019.
But it just gives a #VALUE! error. I must be tired because I cannot find a solution. Any ideas?
Thanks in advance.
PS: In Portugal, Excel uses semicolon instead of comas as field separator.

Related

Storing range in a cell and using it with Vlookup

I need to do vlookup for a range which is variable depending on the date
for example: =Vlookup(a2,http://mypc/[attendance.xlsx]7th March'!$AR:$AS,2,0)
so for the link of the sheet is fine no need to change, but the tab in the sheet it changes according to date:
for example:
if the date is 8/3/2022 the formula will be like this: =Vlookup(a2,http://mypc/[attendance.xlsx]8th March'!$AR:$AS,2,0)
i tried to put the value of the date in a cell and using another vlookup inside the date but it didnt work. i also tried to use indirect formula to recall the sheet link but it didnt work also showing #Ref error.
Btw the lookup value is coming from a table cell.
so any ideas please?

Excel - How to count the number of distinct texts of a specific date inside a table?

I'm trying to count the number of distinct text from a specific date in a data table.
Data Sample with expect result :
I was able to figure out how to count the distinct element from a range I specify, because I can determine the first and last row containing the date.
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
I have tried to modify my formula so that it determines the cell range by itself but without success.
I searched for an answer, using a combination of CELL and MAXIFS, example below, but Excel does not accept the formula.
=CELL("row",MAXIFS(A2:A15,A2:a15,D2))
I've looked at the INDEX formula, but I can't figure out how to do what I want to do. 😑
Any idea what I'm doing wrong, or what I should be doing instead?
Thanks, I appreciate it!
If you have Office 365 and the new Dynamic Arrays, this sort of formula has become ridiculously easy.
This formula in cell E3:
=COUNTA(UNIQUE(FILTER($B$2:$B$15,$A$2:$A$15=D3)))
Copy down.
You can also generate the unique list of dates with this formula in D3, which spills down automatically and does not need to be copied.
=UNIQUE(A2:A15)
It wasn't easy, but by separating each step of the problem, I was able to solve it.
Note that my solution only works because my dates are sorted.
Here's the final formula in the cell "One formula to rule them all":
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2))),INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)))))
Here are my explanations of my process:
Formula if I select the range :
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
Formula to get the first iteration
=ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2)
Formula to get the last iteration
{=ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)}
Create range from two addresses
=INDIRECT(CONCATENATE(F3,":",G3))
Formula giving me the expect result
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(F3,":",G3)),INDIRECT(CONCATENATE(F3,":",G3))))

How to check if a cell is the 17th of any month

I have a column of dates (daily) and I want an IF statement that will check if the corresponding cell is the 17th of any month.
I'm happy with the syntax of if statements but am unsure how I should be using wildcards here. 'x'below can be any numerical value.
The cell in question looks like - 17/07/2019.
= IF( cell = 17/**/****,x,0)
Excel gets confused and tries to show me how to do maths without a formula.
If you already know that the date is not a text value you can use a simple formula like:
=IF(DAY(A1)=17,”x”,0)
The only issue is that your dates may be genuine Excel dates or text values. With data in A1, in another cell enter:
=IF(ISNUMBER(A1),IF(DAY(A1)=17,"X",0),IF(LEFT(A1,2)="17","X",0))

Count based on Week and Year for cells having Hyphens "-"

I have a tasks tracking sheet and want to count number of tasks received based on week number for a particular year. Thanks for the post COUNTIF date occurs in same week number and year
But still i have problem that i have dates in a column where many of the cells are non-empty and filled with Hyphens "-". If i delete Hyphens, formula working fine. But i need to keep "-" in cells where date not entered.
Initially i tried 'Sumproduct' funtion, it shows #Value error because of Hyphen in cells. And i added the code --(Task_Status!$X$7:$X$250<>"-"). But still it showing same error. In my formula, where Q2 is weeknumber 1 to 58 in a rage of cells Q2 to BQ2, that i have to copy(drag) the formula from Q3 to BQ3. And $C$3 is cell having 4 digit Year (E.g. 2019). Please help...
A image here-->Received&Completed_CW
=SUMPRODUCT(--(ISOWEEKNUM(Task_Status!$X$7:$X$250)=Q2),--(YEAR(Task_Status!$X$7:$X$250)=$C$3),--(Task_Status!$X$7:$X$250<>"-"))
Perfect i found a temporary formula... Its working fine if non-hyphen "-" exist until end of cell range specified by INDIRECT function...
=SUMPRODUCT(--(ISOWEEKNUM(INDIRECT("Task_Status!$X$7:$X"&COUNTIFS(Task_Status!$X$7:$X$250,"<>-")+6,TRUE))=Q2),--(YEAR(INDIRECT("Task_Status!$X$7:$X"&COUNTIFS(Task_Status!$X$7:$X$250,"<>-")+6,TRUE))=$C$3))
Please give a better solution than this if anyone found... Because still Hyphen present between start cell X7 and end of cell range specified by INDIRECT function give no result... still need help...
Thank you for all who tried for a solution... and thanks to post Excel Define a range based on a cell value and Using the value in a cell as a cell reference in a formula?

Cell reference calculation within a range formula

I am using this formula to search a range of cells for the letters "cc".
=COUNTIF(G4:G28,"cc")*G3
This lets us know who paid with a credit card. I was told that we also need to know the date. So now I am adding the date to the cell using this format "cc (10/03)" Of course now the formula does not count this cell because the formula is looking for "cc" only. So now I need to replace the "cc" part of the formula with something that looks in the cell for "cc". I think I can use ISNUMBER but that requires that I enter a specific cell in the formula. Since this formula is being used as part of a formula that contains a range, how would I do this?
Hope this makes sense.
Many thanks,
Houston
If you need to have the date in the same cell then you can use a "wildcard" * in COUNTIF like this
=COUNTIF(G4:G28,"cc*")*G3
then that will count all cells that start with "cc"....or a wildcard either side if you need, i.e.
=COUNTIF(G4:G28,"*cc*")*G3
which would count cells that contain "cc" anywhere.
Ideally you would put the date in a separate cell in the same row so that your original formula would still function OK

Resources