IF condition with VLOOKUP in Google Sheets - if-statement

I want to compare below two sheets (compare all the available cells together on both the sheets) with vlookup. if the one line is available in both the sheets then answer should be "Yes!", if else answer should be "No!".
I have below data in sheet1
PONo Code UID
84914741980 VPP5P 14908660
84914741893 VPP5P 14908653
84914750226 XWKGY 14915367
84914740202 XWKGY 14907478
84914751843 R10KJ 14915997
84914750226 R10KJ 14915366
84914759442 CPC7G 14921768
84914750025 TN78Y 14913781
another sheet2 contains below data,
PONo Code UID
84914741980 VPP5P 14908660
84914741893 VPP5P 14908653
84914750226 XWKGY 14915367
84914750025 TN78Y 14913781
84914750025 TN78Y 14913779
84914743001 TN78Y 14909949
84914740202 TN78Y 14907477
84914740202 TN78Y 14907476
84914741893 YH3T9 14908652
I want the answer to be like below
PONo Code UID Answer
84914741980 VPP5P 14908660 Yes
84914741893 VPP5P 14908653 Yes
84914750226 XWKGY 14915367 Yes
84914740202 XWKGY 14907478 No
84914751843 R10KJ 14915997 No
84914750226 R10KJ 14915366 No
84914759442 CPC7G 14921768 No
84914750025 TN78Y 14913781 Yes
Appreciate forums help to get this done!!
I tried the below formula, but it works partially.
=if(ARRAYFORMULA(VLOOKUP($A:$C,sheet2!$J:$L,{1,2,3},false))="","No","Yes")

try like this:
=ARRAYFORMULA(IF(A2:A<>"", IF(IFERROR(VLOOKUP(A2:A&B2:B&C2:C,
Sheet2!E2:E&Sheet2!F2:F&Sheet2!G2:G, 1, 0))<>"", "yes", "no"), ))

Related

Getting value between '-' in google sheets

Im trying to get the number between '-' and '-' in google sheets but after trying many things I still havent been able to find the solution.
Data record 1
England Premier League
West Ham vs Crystal Palace
2.090 - 3.47 - 3.770
Expected value = 3.47
Data record 2
England League Two
Carlisle vs Scunthorpe
2.830 - 3.15 - 2.820
Expected value = 3.15
Hopefully someone can help me out
Try either of the following
option 1.
=INDEX(IFERROR(REGEXEXTRACT(AE1:AE4," \d+\.\d+ ")*1))
option 2.
=INDEX(IFERROR(REGEXEXTRACT(AE1:AE4,".* - (\d+\.\d+) ")))
(Do adjust the formula according to your ranges and locale)
use:
=INDEX(IFNA(REGEXEXTRACT(A1:A, "- (\d+(?:.\d+)?) -")*1))

Calculate the time spent in a room on G-sheet

I am trying to make a calculation on how to automatically see how long Paul, Jack and John spent in the room as shown on the enclosed pic. I cannot figure out if I should have an IF formula added with a VLOOK, but I am not sure and need your expertise. Please help
use in D2:
=ARRAYFORMULA(IF(C2:C="",,IF(ISODD(
COUNTIFS(C2:C, C2:C, ROW(C2:C), "<="&ROW(C2:C))), "IN", "OUT")))
use in E2:
=ARRAYFORMULA(IFNA(TEXT(VLOOKUP(A2:A&C2:C&D2:D,
{FILTER(A2:A&C2:C&D2:D, D2:D="OUT"),
QUERY(FILTER(B2:B, ISEVEN(COUNTIFS(A2:A&C2:C, A2:A&C2:C, ROW(C2:C),
"<="&ROW(C2:C)))), "where Col1 is not null")-
QUERY(FILTER(B2:B, ISODD(COUNTIFS(A2:A&C2:C, A2:A&C2:C, ROW(C2:C),
"<="&ROW(C2:C)))), "where Col1 is not null")}, 2, 0), "[h]:mm:ss")))

How to find the difference in hours between two dates dd/mm/yyyy hh:mm

I have two dates in cells
A1=05.11.2021 18:16
B1=05.11.2021 20:16
I need to find difference in hours between two dates. Result should be (B1-A1)=2 I can't find an answer on the Internet, I ask for help.
use:
=TEXT((DATE(
REGEXEXTRACT(B1, "\d{4}"),
REGEXEXTRACT(B1, "\.(\d+)\."),
REGEXEXTRACT(B1, "^\d+"))+INDEX(SPLIT(B1, " "),,2))-(DATE(
REGEXEXTRACT(A1, "\d{4}"),
REGEXEXTRACT(A1, "\.(\d+)\."),
REGEXEXTRACT(A1, "^\d+"))+INDEX(SPLIT(A1, " "),,2)), "[h]")
arrayformula:
=INDEX(IFNA(TEXT((DATE(
REGEXEXTRACT(B1:B, "\d{4}"),
REGEXEXTRACT(B1:B, "\.(\d+)\."),
REGEXEXTRACT(B1:B, "^\d+"))+INDEX(SPLIT(B1:B, " "),,2))-(DATE(
REGEXEXTRACT(A1:A, "\d{4}"),
REGEXEXTRACT(A1:A, "\.(\d+)\."),
REGEXEXTRACT(A1:A, "^\d+"))+INDEX(SPLIT(A1:A, " "),,2)), "[h]")))
shorter:
=INDEX(IFERROR(1/(1/(TEXT(
REGEXREPLACE(B1:B, "(\d+).(\d+).(\d{4})", "$2/$1/$3")-
REGEXREPLACE(A1:A, "(\d+).(\d+).(\d{4})", "$2/$1/$3"), "[h]")))))
EDIT:
As what #basic mentioned in the above comment, you can format the cell where your output goes or use text with h for hour difference and [h] for the whole duration in hours (got from Cooper's answer). See usage and difference below:
Text:
=text(B1-A1, "h")
or
=text(B1-A1, "[h]")
Update:
Make sure your Date Times uses proper delimiters. / and - are acceptable (e.g. 5/11/2021 18:16:00 or 5-11-2021 18:16:00). (This depends entirely on your locale.)
If you want to show it having . as delimiter, just use a custom Date Time format and use . as its delimiter.
Using custom format:
Actual value vs Display value:
If you don't want to do any changes to the date time and want to have it as text, then replace them using regexreplace before using them in text.
RegexReplace:
=text(REGEXREPLACE(B1, "\.", "/") - REGEXREPLACE(A1, "\.", "/"), "h")
or
=text(REGEXREPLACE(B1, "\.", "/") - REGEXREPLACE(A1, "\.", "/"), "[h]")

Replace blanks with a string with DAX coding in Power BI

I have a data in Excel and I have uploaded in power bi, created a visualisation using a chart which looks like -
blank, CP, Jj10 are basically my y axis and dashes are my bars of horizontal chart. I have tried to show how my chart looks like because I don't get any other option
(Blank)-------------998
CP-----------56
Jj10--------44
0BN--------------77
Hi-po---2
Naas-------21
There is a column named performance (sheet_name=Empl_data) and what I want is to replace the blanks with Non-GT in power bi with creating a new column.
What my output should look like -
(Non-GT)-------------998
CP-----------56
Jj10--------44
0BN--------------77
Hi-po---2
Naas-------21
I have tried this -
Non-GT = IF(ISBLANK('Empl_data'[performance]),"Non-GT",'Empl_data'[performance])
What i get is
Non-GT----------------964
(Blank)-------------34
CP-----------56
Jj10--------44
0BN--------------77
Hi-po---2
Naas-------21
I just want to replace blanks with Non-TSG completely but still it shows blank. Please help me out to solve the problem and please let me know if I have made clear what my prblm is.
My data -
Empl_id
Empl_name
performance
99807
Somman paul
0076
Richards.M
8870
Maheen Josef.T
11209
Dojar Farah
6651
Macklegn Sagoe
Hi-po
551
Cada Farez
Jj10
12
Qwezy Goha
Hi-po
6567
Beheriop Produse
CP
2227
John semmers
0BN
656
Majeeio .f
80100
Drejju Yan
Is it actually Blank where it is showing nothing? First confirm there are spaces or really null in the data, then apply conditions as bellow-
Non-GT =
IF(
'Empl_data'[performance] = BLANK() || 'Empl_data'[performance] = "",
"Non-GT",
'Empl_data'[performance]
)
Q: Where you are transforming data with that condition? Power Query Editor? Or creating Measure or Calculated column?

Add leading '$' to google charts

I am working with Google Charts. I need to add a '$' before the values on the y-axis as well as the value in the bubbles.
Is there a setting for this?
take care,
lee
UPdate,
Here is the data being used by the charts:
'Month','Semi-Detached in Toronto E04','Semi-Detached in Toronto E08','Condominium Townhouse in Toronto E04','Condominium Townhouse in Toronto E08', ],
['7/2011', 4354000,15305800,6776500,495000],['8/2011', 700000,10514418,7060786,0],['9/2011', 6854800,17805400,12087300,0],['10/2011', 7287400,14248900,16206500,0],['11/2011', 2696245,9733270,12698090,0],['12/2011', 1965800,6054500,8854390,0],['1/2012', 2450968,9012200,5500100,0] ]);
I've tried adding '$' before the values as well as '%24' as suggested before, but both throw syntax errors. And the values cannot be quoted without throwing a Google Charts error '
Data column(s) for axis #0 cannot be of type stringĂ—'.
Thanks everyone for your input. I found a question that was 99.9% the same:
How to set tooltips to display percentages to match axis in Google Visualization Line Chart?
Try using %24 which is the urlencoded form for $.
Use:
var formatter = new google.visualization.NumberFormat({prefix: '$'});
Check the example here:
https://developers.google.com/chart/interactive/docs/examples#interaction_example
More details here:
https://developers.google.com/chart/interactive/docs/reference#numberformatter