Excel spreadsheet - excel

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

Related

combine all cells, numbers and symbols to a sum

Good day,
I'm at a loss on this problem.
I have a group of cells that contain words, like apple, this word would be the value. It is separated by a symbol for completing the math. They can be changed by the user to make custom calculations.
Cell A1 is "apple", B1 is "+", cell C1 is "apple", cell D1 is "*", cell E1 is "apple", call F1 is "=" and cell G1 is the suggested total, in this case would be "6".
It would be posted as | apple | + | apple | * | apple | = | 6 |
The legend holds the value for the word, so if you enter 2 in the legend, apple would be 2.
The logic would determine that the formula would be 2+2*2= if written in excel, I would like to combine all the cells and calculate this.
I tried using =sum, sumproduct, concate and the like to no avail.
Any head way I did make, I ended up getting BEDMAS wrong as it calculated it as 2+2=4*2=8, instead of the correct 2*2=4+2=6.
Anyone know of a way to combine these cells and properly sum the values to the correct total?
Thank you for your time!
Go to the Name manager and create named range Eval, into Refers to field add formula:
=EVALUATE(CONCATENATE(VLOOKUP(Sheet1!A1,Sheet1!$A$3:$B$5,2,0),Sheet1!B1,VLOOKUP(Sheet1!C1,Sheet1!$A$3:$B$5,2,0),Sheet1!D1,VLOOKUP(Sheet1!E1,Sheet1!$A$3:$B$5,2,0)))
In range A3:B5 I have legend.
Change references as you need. Then in cell G1 write formula =Eval.
Sample:
This is a UDF based solution. Its advantage is that it's more versatile and by far easier to maintain if you learn its elements of code. The disadvantage is in that you do have to learn the elements of code and you have an xlsm macro-enabled workbook which isn't welcome everywhere.
The setup is simple. I created a table with columns Item and Value. I placed it on another sheet than the task. In fact, you could make the sheet with the table VeryHidden so that the user can't look at it without access to the VBA project, which you can password protect. I called the table Legend. The item columns has names like apple, pear, orange. The Value column has the numeric values associated with each name.
Note that, since this is a VBA project, the entire list can be transferred to VBA leaving no trace on the sheet. You could have a function to display the value of each item as the user clicks on it and have it disappear as he clicks elsewhere.
Next I created a data validation drop-down in A1 with the List defined as =INDIRECT("Legend[Item]"). Copy this cell to C1 and E1.
Then I created another Data Validation drop-down in B1 with the list as +,-,*,/. This drop-down must be copied to D1.
Now the code below goes into a standard code module. Find the way to create it because it isn't any of those Excel sets up automatically. It's default name would be Module1. Paste the code there.
Function Evalue(Definition As Range) As Double
Dim Task As String
Dim Fact(2) As Double
Dim C As Long
Dim i As Long
With Definition
For C = 1 To 5 Step 2
On Error Resume Next
Fact(i) = Application.VLookup(.Cells(C).Value, Range("Legend"), 2, False)
i = i + 1
Next C
Task = "(" & Fact(0) & .Cells(2).Value _
& Fact(1) & ")" & .Cells(4).Value _
& Fact(2)
End With
Evalue = Evaluate(Task)
End Function
Now you are ready for testing. Call the function from the worksheet with a call like
=Evalue(A1:E1). You can use it in comparisons like =IF(G6 = Evalue(A1:E1), "Baravo!", "Try again"). As you change any of the components the cell with the function will change.
Remember to use absolute addressing if you copy formulas containing the range. If you need to get a result in VBA while testing, use this sub to call the function.
Private Sub TestEvalue()
Debug.Print Evalue(Range("A1:E1"))
End Sub
My Sheet
Here is what I have.
In cells M - U, i count all the instances of the word from cells E, G and I from the legend.
=SUMPRODUCT((LEN(E3)-LEN(SUBSTITUTE(E3,$B$3,"")))/LEN($B$3))
In cells W - AE, I multiply the instances with the value to give me a total each time the word appears.
=SUM(M3*$C$3)
In cell E8 - I8, i add the three possible values together.
=SUM(W3:Y3) so each worded cell is now a number.
I'd like to take the cells E8 - I8 to make a calculation in k8 and so on.
So, each cell is put together to make an
=SUM(E8:I8)
statement, which all works except E11 - I11 which equates to 26 instead of 43.

Macro is not reading the correct value from a cell which contains a math formula

I have a Excel Workbook that is a template and is populated using macros.
In a several cells, I have a formula =abs(sum(H20:P20)).
In my macro, I am trying to hide the row based on the value in that cell.
I reference those cells from a named range using an offset that does not change and then iterate over 8 lines to decide whether to hide them or not.
I have tried various 'Evaluate' and 'Calculate' functions on the cells in question thinking that maybe it was not evaluating the formula in the cell.
For s = 1 To 8
If Worksheets(sheet1).Range("Spend").Offset(s, 15).Value = 0 Then
Worksheets(sheet1).Range("Spend").Offset(s, 15).EntireRow.Hidden = True
End If
Next s
I expect it to hide several of the rows but it does not do anything. After all macros are done in the file; and the rows have not been hidden, I run that same macro again. On this second run, it hides the rows correctly.

Excel hyperlink / navigating to different sheet

Currently I have two sheets in my spreadsheet.
On Sheet 1, I have 3 cells setup for how many tests passed, failed or received an NA (Actually labeling in Sheet 2 is- Pass, Fail and NA). On Sheet 2 (Cells V through AB), it contains PASS, Fail, and NA comments.
Sheet 1 picture:
Sheet 2 Picture:
I want to setup what is called I think a hyperlink but it does not function the way I need it too.
What I am trying to do:
For example, when clicking the cell B4 underneath UAT Passed in sheet 1, I want it to navigate to sheet 2 and either highlight or display only the cells that have the word Pass in them (with all the row details as well). I want to apply this to Fail and NA as well.
Along with this, in cells B4 through D4 on Sheet 1, I would want it show to the # of "Pass, Fail and NA" that exists through cells V through AB.
If I am not clear please let me know.
Here is my current setup/formula:
Use the Follow_Hyperlink event which has range called Target as a parameter, which is the cell containing the hyperlink. Use the range to set up your logic e.g:
If Not Application.Intersect(Target, Range("B4")) Is Nothing Then
Sheets("Sheet2").Activate
End if
Figured out the answers on my own. The following formula worked best for me:
=CONCATENATE(COUNTIF(Script!V2:AB67,"PASS"))
=CONCATENATE(COUNTIF(Script!V2:AB67,"NA"))
=CONCATENATE(COUNTIF(Script!V2:AB67,"FAIL"))

Using Index Match between two sheets in excel

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))}

Unsure of how to use cell data to get data from another worksheet

This is a weird sort of function that I've never tried to use before, so I'm not sure how to go about asking without using an example.
Essentially, I have a column of strings that represent datasheets in this .xls file. Each row has data in it that corresponds to the datasheet named in said column. In case my explanation is insufficient, here's an example:
Worksheet 1 : Worksheet 1 Value 1 : Worksheet 1 Value 2 : .......
Worksheet 2 : Worksheet 2 Value 1 : Worksheet 2 Value 2 : .......
etc...
At the moment, the spreadsheet requires you to manually update the worksheet reference for each column to populate the data, i.e. for every cell, I need to manually fill out the worksheet name in this equation:
='Worksheet 1'!B111
This works, but is obviously suboptimal, as I have a large number of worksheets. What I WANT to do is be able to do is be able to fill out Cell 1 (the worksheet name) and have every other cell use the worksheet name as its reference, like so:
Column A : Column B : Column C : ...
"Worksheet 1" : =A1!B111 : =A1!B34 : ...
"Worksheet 2" : =A2!B111 : =A2!B34 : ...
First question: Is this possible?
Second quesion: How?
Sorry if this has been answered already, but I could barely figure out how to ask the question in the first place.
You can use the INDIRECT() function. With the text Worksheet 1 in cell A1 you can use
=indirect("'"&$A1&"'!B111")
Since the sheet name can contain spaces, you need to start the text of the Indirect with a single quote, append the cell with the sheet name, then append the closing single quote, the exclamation mard and finally the cell reference.
If all cells in column A refer to B111, just copy the formula down and change the sheet name in column A. Copy the formula across and adjust the cell reference for B111 to whatever is desired before copying down.
If you want to pre-populate a worksheet with these values, fire up the macro recorder, create a new sheet, go to an existing sheet and copy and paste everything into the new sheet, then stop the macro recorder. That will give you a starting point for the code you need.

Resources