How not to show zero while retrieving a value in excel - excel

I have an excel file in which i have two sheets. Sheet 1 named "cert" which is a certificate which retrieves and displays value from sheet 2 (lets say sheet 2 as Oct). Sheet 2 "Oct" is like following:
MT MMBTU
Date1 value1 value1
value2 value2
value3 value3
Date2 value1 value1
value2 value2
value3 value3
Each day have 3 values each and it will continue till the last date of the month.
And my sheet 1 "cert" which retrieves value from sheet "Oct" looks like following:
MT: value 1 value2 value3
MMBTU: value 1 value2 value3
Sheet "Oct" have formula for finding MMBTU from MT. So each time a value is entered in MT, MMBTU will appear in respective cell. My issue here is as the MMBTU coloumn has formula in it, zeros will be appearing in each cell and when MT value is entered, zero will replaced by value. In sheet "cert" i am retrieving last entered values for MT & MMBTU. Values for last entered MT is appearing correctly but for MMBTU it is displaying zero because the coloumn from which the value are being retrieved has been already filled with zeros from the formula (formula which converts MT to MMBTU). How to fix this?

Assuming MT: is in A1 and Date1 is in A2, maybe in B2 and copied across to D2:
=INDIRECT("Oct!"&ADDRESS(MATCH(LOOKUP(1E+100,Oct!$B:$B),Oct!$B:$B,0)-4+COLUMN(),3))

Related

How sum in excel only for given value

I have in excel something like:
A B
1 Value1 10
2 Value2 20
3 Value1 5
4 Value1 10
5 Value2 15
How I can sum for given value in A? For example, having something like this:
6 C D
7 Value1 25 (sum of b1+b3+b4)
8 Value2 35 (sum of b2+b5)
Of course, how can I do this automatically and not manually.
Thanks very much.
Let's assume you have a list of the unique values in column A listed in column C, i.e.:
Row A B C
1 Value1 10 Value1
2 Value2 20 Value2
3 Value1 5
4 Value1 10
5 Value2 15
In column D, the following formula will count the occurences of each value in column C:
=SUMIF(A$2:A$6, "=" & $C2, B$2:B$6)
This should be pasted into D2 and then copied to D3, D4, etc.
The result will look like:
Row A B C D
1 Value1 10 Value1 25
2 Value2 20 Value2 35
3 Value1 5
4 Value1 10
5 Value2 15
How does this work? SUMIF allows criteria to be used, and if satisfied, a SUM of the cells is taken. In this case, the SUMIF does this:
Looks in cell range A$2:A$6
Compares the value in each cell to see if it is equal to $C2 (or $C3, etc dependent upon which row is being calculated)
If it is equal, sum the value from the cell range B$2:B$6
Limitations
In order for this to work, the unique values in column A must already be known and listed in column C. There are some ways of generating a list of unique values but they are not straight-forward. Roll on UNIQUE which ships with the new version of Office.
There are different ways to do this:
Use a pivot table (as already mentioned in the comments).
Use a SumIf() worksheet function (as mentioned in another answer). This, however, will only work if you know all names (like Value1, Value2, ... (the list MUST be limited))
Use subtotals. This, however, will only work when you sort first.
Write a VBA macro.

Fill blank cell in Excel with value with same ID

I'm not so advanced in excel I need help if is it possible to do.
I have an excel with this column:
ID - Value1 - Value2
I need to update the value1 (or value2):
- only if are blank AND only if the row has the same ID
I make an example, I have this table:
ID Value1 Value2
A1 1 100
A2 2
A3 3
A4 1 200
A5 2 250
Iwould like to fill all the empty cell in this way
ID Value1 Value2
A1 1 100 200
A2 2 250
A3 3
A4 1 100 200
A5 2 250
Thank you for any help.
Ok, so your data is a mixture of numbers and texts. You can generate two new columns with the desired values using formulas. Choose two new, adjacent columns, say D and E, and enter this CSE formula in row say in cell D2:
D2:
=IFERROR(IF(ISBLANK(B2),INDEX(B$2:B$99,
MATCH(1,($A$2:$A$99=$A2)*(1-ISBLANK(B$2:B$99)),0)),B2), "")
CtrlShiftEnter
Enter the formula in D2 with CtrlShiftEnter and then copy/paste in the cells of columns D and E (or as I said any two adjacent columns).

Copy/Move cells by id

How can I move values from Worksheet 1 column B to Worksheet 2 column B, based on a unique ID in column A? Some IDs are duplicates and some values are empty, I would like to ignore empty values.
Worksheet 1:
A B
23452 value1
23452
53252 value2
67452 value3
Worksheet 2:
A B
53252
23452
67452
Wanted Result (Worksheet 2):
A B
53252 value2
23452 value1
67452 value3
What I have tried
Merging data in Open/Libreoffice calc - could not figure this out for my specific requirements.
You can try this simple INDEX-MATCH formula,
In column B of sheet2,
=INDEX('Sheet1'.A:B;MATCH(A1;'Sheet1'.A:A;0);2)

Counting duplicate rows using Excel

I need to count the number of duplicate occurrences of values in a column using excel, ONLY for rows with a certain value in second column i present.
Column1 Column2
value1 x
value1 x
value1 x
value1
value2 x
value2
value3 x
---> should give
VALUE Occurencies
value1 3
value2 1
valu3 1
How to do this?
Thanks!
You can use a pivot table, which does not require any typing of values or any formulas.
Drag column1 into the row area and column2 into the values. If it is text, it will be counted. If the other values in column 2 are blank you are done. If they contain values, you can drag column2 into the filters area and then use the filter dropdown above the pivot table to select what value in column2 to use.
After you add new data to columns A and B, select the pivot table and refresh it.
If Column1 is in A1, please try:
=COUNTIFS(A:A,D2,B:B,"<>")
copied down to suit where D2... contain Value1 etc

Excel vlokup with partial string

I have 2 excel sheets, sheet A
Column A | Column B
12ABC Value1
14AZC Value2
44AXC Value3
73XBC Value4
and second sheet
Column A | Column B
BC Value5
14AZC Value6
44A Value7
I need to make vlookup on Sheet1 with data from Sheet2.
The problem is that I need to use only partial string from Sheet2, as there may be more than 1 possible way to match both values. In result, I would need result:
Column A | Column B | Column C
12ABC Value1 Value 5
73XBC Value4 Value 5
I tried with, but I need it the other way around
=IF(NOT(ISBLANK(A2)); VLOOKUP(A2 & "*"; Sheet2!$A$1:$B$40;2;FALSE))
If you want to use VBA it's very simple:
Public Function FindOcc(Base As Range, Serc As Range) As String
For Each x In Serc
If InStr(Base.Value, x.Value) > 0 Then
FindOcc = x.Offset(0, 1).Value
Exit Function
End If
Next
End Function
Otherwise you can use the a Hidden Column for each data in the sheet2. Following the scheme:
Use the formulas:
E3 -> =F3&G3&H3
F3 -> =IFERROR(IF(FIND($A$10;A3);$B$10;"");"")
G3 -> =IFERROR(IF(FIND($A$11;A3);$B$11;"");"")
H3 -> =IFERROR(IF(FIND($A$12;A3);$B$12;"");"")
...
and autocomplete...
In the column E you have the result...

Resources