I have two sheets.
This is the first sheet. Named 3
And this is the second sheet. Named centralizare
I have to write in Sheet2 C5 the number of 'Id garantie' from Sheet1 if the 'Categorie' from Sheet1 is 'Done' (Sheet2 B5) and 'Status 1'from Sheet1 is 'In lucru' (Sheet 2 B4)
I tried this
=COUNT(INDEX('3'!$C$2:$C$99,MATCH(B5,'3'!A2:A99,0)))
but it returns only one number if only the 'Categorie' is Done.
And other method with errors
=MATCH('3'!C2:C99,(centralizare!C5='3'!B2:B96)*(D4='3'!F2:F96),0)
=INDEX('3'!$C$2:$C$99,MATCH(D5,'3'!C2:C99,0))
=COUNT(INDEX('3'!A2:A96, MATCH("In lucru",'3'!E2:E96)))
You could try an array formula with sumproduct:
=SUMPRODUCT(--IFERROR((('3'!A2:A5=centralizare!B5)),0))
Must be entered using ctrl + alt + enter. Is should appear like so in your formula bar if done right:
{=SUMPRODUCT(--IFERROR((('3'!A2:A5=centralizare!B5)),0))}
Sample workbook: https://filetea.me/t1sjZdwkvxrRxGePZmKZyB7BQ
EDIT: It also seems that you should never had "finalizat" & "wip" in the same row, if I understand your rules right. WIth the array formula, you can check for both rules & only count those that meet both rules, not just one, and somewhat check data quality this way.:
{=SUMPRODUCT(--IFERROR((('3'!A2:A5=centralizare!B5))*('3'!C2:C5=***choose a cell/range where you put a reference to finalizat/in luru instead of wip/donw***),0))}
In other words, the general format for multiple criterial is:
{=SUMPRODUCT(--IFERROR(((CRITERIA ONE)*(CRITERIA TWO)),0))}
Related
Maybe I have used the wrong phrase to search but I have not been able to find a solution to the following challenge for Excel/VBA:
In Sheet 1 I have a database of order data from cells A1 to F10. Each row contains data for one order. Column A contains the order number.
As first step I, in sheet 2, wish to make a search on the order number and retrieve all data for that order into cells A5 to F5 in sheet 2.
After reviewing the data (and running another macro to recalculate the sales price) I wish to have the revised data replace the original data in sheet 1.
Can anyone help me with this?
Thank you in advance!
The 1st part does not need macro.
vlookup (fkeres magyarul) is your function. If you put this function in A5-F5 fields in sheet 2, looking for a given order number, in Sheet1 $A$1:$F$10, entering the required column number, asking exact match (FALSE), it works nicely. I entered the functions parameters in my previous sentence.
The 2nd part needs macro which makes Copy Paste back.
OR
Look for the requested order row in sheet2 A5 cell with MATCH (HOL.VAN magyarul) function, like =MATCH(A1;Sheet1!A1:A10;0)
and put INDIRECT (INDIREKT magyarul) function, like =INDIRECT("Sheet1!B"&A5;TRUE) in B5, etc.
In this case the Copy-Paste back macro is (starting from Sheet2):
Myorder = Range("A5").Value
Range("B5:F5").Select ' A5 is the row number of order, not the order No
Selection.Copy
Application.Goto Reference:=Worksheets("Munka1").Range("A" & Myorder)
ActiveSheet.Paste
...or very similar
I am trying to use a formula that would let me copy and paste it down so I dont have to link every-time
The source workbook has tabs named 1,2,3,4,5.....100
I want to use simple formula ='[test.xlsx]1'!$O$117
but I want to replace ='[test.xlsx]**A1**'!$O$117
so it is dynamic and I can copy it down
='[test.xlsx]B1'!$O$117; where B1 = 2
='[test.xlsx]C1'!$O$117; where C1 = 3
I tried ='[SCD PCAP 2Q15 - waterfall.xlsx]&1&'!$O$117
any ideas?
You can do so by Two step process.
Step 1 (Thanks to #Excel Hero for this answer)
1
Open the Name Manager. Control-F3 from the worksheet, and then click the New button.
2
For the Name field in the dialog, enter EVALXFD. I just picked this name it is using column XFD in it. But you can pick whatever name you like.
3
For the Refers to field, enter this
=EVALUATE($XFD1)
4
Click OK and then Close.
Step 2
Paste below mentioned formula in last helper column XFD (I am assuming you are not using this column)
=CONCATENATE("='[Test.xlsx]",$A1,"'!$A$1")
In B1 enter this formula and drag it down:
=EVALXFD
That's it.
Use the INDIRECT() function. E.g., with $A$1 = 2, $A$2 = 3, ..., you can use
=INDIRECT("'[test.xlsx]"&B1&"'!$O$117")
which Excel will concatenate =INDIRECT('[test.xlsx]2'!$O$117) and then evaluate.
Note also that I've written the references above based on copying the formula down column B (with references in column A), so the row number will change, but the reference will always be to column A.
I have an Excel workbook with many sheets (today, about thirty, and growing every day). Each worksheet is named for the date of the data it contains (e.g., 02-10, 02-11, etc.). In cell A2 of each worksheet is a number, and I want to write a formula that looks at cell A2 in every worksheet, and returns the largest one.
I created a list of the current worksheets and named it DayWorksheets, and I attempted to get the value using the formula
{=MAX(INDEX(INDIRECT("'"&DayWorksheets&"'!A2"),0))} (brackets shown to denote array formula).
But the result every time is "10," which is the number in cell A2 of the first worksheet in the named range (and it's not the largest). What am I doing wrong here? I've seen a few other formulas around, the likes of
=VLOOKUP(C1,INDIRECT("Sheet"&MATCH(TRUE,COUNTIF(INDIRECT("Sheet"&ROW(INDIRECT("1:10"))&"!A2:A100"),B1)>0,0)&"!A2:B100"),2,0),
but I don't quite understand the purpose of the countif function in there. Any help would be appreciated.
You can use formula with 3D-reference like this:
=MAX(Sheet1:Sheet30!A2)
Click the cell where you want to enter the function.
Type = (equal sign), enter the name of the function (MAX), and then type
an opening parenthesis.
Click the tab for the first worksheet that you want to reference.
Hold down SHIFT and click the tab for the last worksheet that you
want to reference.
Select the cell or range of cells that you want to reference (A2 in your case).
Complete the formula (add closing parenthesis), and then press ENTER.
Lets say
sheet3.name = "d"
Is there a way I could put in a cell on sheet2 the formula =sum(sheet3!b:b) where sheet3 is being substituted with the actual sheet3 name?
I can only get =sum('d'!b:b) to work so far.
I could use VBA for this probably but I'm curious how to do this in a cell so I don't have to run a macro each time.
If you can use a UDF User Defined Function that will return the sheet name
Function SHEETNAME(number As Long) As String
SHEETNAME = Sheets(number).Name
End Function
then a formula like
=SUM(INDIRECT(SHEETNAME(3) &"!B:B"))
will return the sum from column B on sheet 3.
SHEETNAME(number) returns the sheet name of the number which is index.
So Sheet(1) returns Sheet1, etc
Use below formula anywhere in the sheet to get the sheet name - the sheet must have a filename for this to work:
=REPLACE(CELL("filename"),1,FIND("]",CELL("filename")),"")
You can either reference that cell using Indirect:
=SUM(Indirect("'"&A1&"'!B:B"))
or, if you don't want to have a second cell, you can combine the two formulas into one:
=SUM(INDIRECT("'"&REPLACE(CELL("filename"),1,FIND("]",CELL("filename")),"")&"'!B:B"))
For anyone not concerned with the order of the sheets, the post by Biff here on mrexcel.com works well.
In Excel 2013, go to the Formulas tab in the ribbon and make a defined name:
Name: SheetNames
Refers to: =GET.WORKBOOK(1)&T(NOW())
Then use a formula like this example:
=INDIRECT("'"&INDEX(MID(SheetNames,FIND("]",SheetNames)+1,255),A3)&"'!A1")
where A3 refers to the index number in a cell in the current sheet, and A1 refers to the location of the value to be retrieved from the other sheet. I.e., in the current sheet, if A3 = 2, then the formula will point to cell A1 in the second sheet of the workbook. I just use a column of index numbers in my current sheet, then drag this formula down and it fills in values from all of my other sheets.
You will need to save as a macro-enabled file (.xlsm).
I'm not sure if this is a good idea but it's the first one I could think of.
I would add additional function to your VBA project which will return actual name of your Sheet3:
Function Sheet3Name()
Sheet3Name = Sheet3.Name
End Function
Next, when you create sum formula of column B:B in Excel cell you need to do it in this way:
=SUM(INDIRECT(Sheet3Name()&"!A:A"))
I need a way of displaying 3 cells of data.
For example
Cell 1 Cell 2 Cell 3
20 140 Lee
12 110 Kerrie
Whenever anyone's name is input in cell 3 I need a separate spreadsheet to display the name (cell 3) and the information in cells 1 & 2 (the information in cells 1 & 2 will always be different).
From your question it's unclear whether you're talking about a person's name input into a single cell (e.g., "C3") or somewhere in a given column (e.g., "C:C").
In the former case you can easily use Guiness's suggestion; or you can even more easily write a formula like this to concatenate the values in Cells 1 through 3 (supposing the worksheet is called "Sheet1"):
="Name = "&Sheet1!C3&": Cell1 = "&Sheet1!A3&", Cell2 = "&Sheet1!B3
(This is based on Cells 1 through 3 in your example being in columns A through C, and in row 3.)
On the other hand, if you're talking about the latter case and you want to run some VBA code whenever a new name is ADDED to column C, you can use the Worksheet_Change VBA function. If this is the case, edit the question to indicate that.
Say you have Excel workbook 1 called Book1.xls. Open that workbook and type the following in the first three rows and across first three columns
Row 1 - cell1 cell2 cell3
Row 2 - 20 12 Jee
Row 3 - 87 25 Kee
Now open the other Workbook - say Book2.xls. Select the cell in which you want to put the value. In that cell press "=" (the 'equals' sign)
Now this is the important bit. After pressing that 'equals' go back to the first excel workbook and select the cell, the content of which you want entered in the second workbook.
So, in this case, the cell in the second workbook will have a formula like this
=[Book1]Sheet1!$A$2
Do the same for the rest of the cells you want.
Important: Please note that the second workbook will not be filled unless the first workbook is opened also.
Use the function: VLOOKUP