Questions tagged [conditional-statements]

"In computer science, conditional statements, conditional expressions and conditional constructs are features of a programming language which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false. Apart from the case of branch prediction, this is always achieved by selectively altering the control flow based on some condition." -- Wikipedia

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

How Do I Write This If Statement For Combinations of Six Numbers

My code below gives combinations of 6 numbers from a total of 52 numbers. Now I applied a condition using an if statement. The condition is that the code must give me only combinations such that in ...
Thando 's user avatar
0 votes
0 answers
3 views

Sum consecutive instances of numbers greater than value

I have a challenge to sum consequtive numbers in a single row where they are greater than 0. I'll provide a data sample with 2x possible results A or B data 0 0 1 3 0 4 2 1 1 0 0 1 0 2 3 1 0 8 ...
Ryno Lamont's user avatar
0 votes
0 answers
3 views

Arrayformula with sum and offset condition

I have monthwise data in column S3:Z3035, month named in column S,T... etc as April, may... So on. Client name is in column A. I put month in dropdwon in cell B2. I want sum of individual client in ...
shailendra singh patel's user avatar
0 votes
1 answer
40 views

formatting formula Highlight all cells in a column of text strings sentences, that contain any of the phrases or keywords from another column in excel

I have a list of sentences in column A. and a list of keywords and phrases in column B. I need a conditional formatting formula or some other way of highlighting any of the sentences in column a that ...
H-M's user avatar
  • 1
0 votes
0 answers
9 views

Color cell offset of cell contain date conditional formatting

Im looking for a conditional formatting formula that color a cell 2 rows down of a cell with a date (when its 2 months before that date). the date cell do color already within 2 and 1 month to today. ...
arjan kooger's user avatar
0 votes
2 answers
49 views

I have no idea how to make this IF statement work in Oracle SQL

I'm writing a code which goal is matching a name from one table to a name in other table. However all names in the both tables were given by a multiple people from different parts of country and are a ...
krumpirko8888's user avatar
0 votes
0 answers
34 views

How can I write a function in python that when an agent makes a move, in its next move it cannot make the reverse move

Agent1 is making moves by moving a tile which contains either the number 1 or 2 and Agent2 is making moves by moving a tile containing the number 8 or 9. The two agents are in a 3x3 board environment ...
Karl's user avatar
  • 9
0 votes
0 answers
4 views

how to retain labels

after adding the 2nd if, label2 appeared on the chart but label1 is gone. how can i keep both labels? in fact i have 3 conditions and i want to label then 1, 2 and 3 if they are met in sequence. how ...
dcmb's user avatar
  • 1
0 votes
0 answers
69 views

Apps Script Time Based Conditional Formatting

My apologies if I don't word this perfectly as I am a novice coder. I am Using Googles Apps Script I am trying to setup a system to conditionally format cells within Google Sheets. This is for a ...
Jake's user avatar
  • 11
0 votes
1 answer
24 views

Assign values to raster from another raster based on condition with holes

I have three raster layers that I would to update based on certain conditions. lc : landcover b : input snowcover c : modified snowcover When the landcover is "anthropogenic", I would like ...
user3386170's user avatar
0 votes
2 answers
43 views

How to debug an issue in meal generator

I have a meal generator that generates meals for 4 days of the week. There are some meals that I want to count as 2 meals because they produce leftovers. I also have some of the meals in groups (pesto,...
monki_mayn's user avatar
0 votes
4 answers
65 views

Sum With Conditions In Excel Sheet

500g (Pkr 700) 500g (Pkr 1250) 500g (Pkr 900) 500g (Pkr 350) Pkr 1000 Pkr 750 This is the data from the Third row of the sheet . What formula should i use To extract values coming after Pkr and ...
Haris's user avatar
  • 1
0 votes
1 answer
45 views

Conditional for links (JS)

I need your technical help for a conditional that I need for a JS file (I haven't deep technial knowledge, that's why I need your help). In the file, I print the information that is sourced in an ...
ADT's user avatar
  • 1
0 votes
1 answer
34 views

Python str.contains

I use this code to see if details contain Mercedes and details contains 123. How do I do to get details that contain Mercedes and doesn't contains 123. color1 = "Mercedes 123" color2 = &...
Joao Beca's user avatar
1 vote
1 answer
39 views

Too many open files when testing a URLs list status in R

I am running a code that works perfect until the dataset becomes large. It tests URLs status and inserts a new variable in the data with the status code returned by the server. I'm not providing data ...
Javi's user avatar
  • 111
0 votes
0 answers
40 views

Jooq (PostgreSQL) - condition build from list of substrings, case-insensitive

I'm looking for a efficient way to find items in a table (lets say Location) with a column "short_name". In my Kotlin code I have a couple of filter queries and in two of them a property ...
bobig12's user avatar
0 votes
2 answers
88 views

Eliminating Some Combinations From a List of Lists in Python

The code below gives all possible combinations of 6 numbers from 1 to 52. It gives these combinations in a list of lists. However I want to eliminate some of these combinations. The combinations I ...
Thando 's user avatar
-2 votes
1 answer
87 views

Tighten up an IF/Elif/Else exercise [duplicate]

I'm writing a short exercise based around IF/ELIF/ELSE. You can tell I'm a complete newbie. I'm somewhat proud of what I've figured out so far on my own, but there is something I'm struggling with. I'...
Hueski's user avatar
  • 1
0 votes
1 answer
31 views

Python Dataframe: If Value in Column Equals String AND Value in Second Column is Null, Replace the Null Cell With Another String

I have the following sample python dataframe below: Type Value A sesame B A C tea A bun The code to create the table is below: import pandas as pd df = pd.DataFrame({'Type':["A","...
PineNuts0's user avatar
  • 4,926
0 votes
0 answers
13 views

Cmake: how to exclude and rename during Install directory

I am working on a moderately sized project that uses cmake. (I know virtually nothing about working with cmake) We are targeting both a 64bit and a 32 bit build. I have a problem with some libraries ...
Matthew W Hume's user avatar
-2 votes
0 answers
31 views

Woocommerce order mail send to specific store (conditional logic) [closed]

I have a woocommerce shop and now we have two real shops. We would like that the customer selects his pickup store and after checkout the selected store receives the mail and not only admin. In the ...
xwalkerbel's user avatar
0 votes
2 answers
40 views

Using mutate and grepl with multiple conditions

I'm attempting to use mutate and grepl to modify a column based on specific conditions in 2 other columns. One of those conditions is met by matching specific words in one of the columns. Both ...
user3670179's user avatar
2 votes
1 answer
47 views

Is there any way to create a conditional statement with variables in CSS?

"I'm attempting to create a gallery where clients can choose the number of columns. I've implemented a range selector in my admin panel, allowing clients to choose between 1 and 6 columns. I've ...
Janine Margueron's user avatar
-2 votes
1 answer
50 views

Handling conditions with Playwright assertions

So the idea is that if the condition is False, then take some Action, but for some reason, it make action with condition = false. Appreciate any help! const condition = await expect(this.page....
Stanislav Step's user avatar
0 votes
2 answers
71 views

Changing NLog Variables (C#)

I would like to know how to check the value of the deviceId variable in the NLog.config file. Now, the deviceId variable in C# code and the deviceId variable in the NLog.config file are two different ...
tridjam's user avatar
  • 21
0 votes
1 answer
61 views

I'm trying to create a "Rock, paper, scissors" game, but if-else-if isn't 100% returning the correct values as it should

I'm sort of new to JavaScript, and I'm attempting to create a Rock, paper, scissors game. Here's my code: let choices= ["Rock", "Paper", "Scissors"]; function ...
CrimKingX49's user avatar
1 vote
1 answer
53 views

Performing conditional linear interpolation in Python

My if else statement is not performing correctly. The following code is an example dataset, data1_df is the table in which I want to use for linear interpolation to get the interpolated value based on ...
N M's user avatar
  • 11
0 votes
1 answer
21 views

Using COUNIF with with filtered rows

I am attempting to use a COUNTIF function to count the number of times a specific product fails testing in a list of many tests. Something like: =COUNTIF(B1:B1000,"fail") BUT ONLY IF,(C1:...
amelia's user avatar
  • 1
-2 votes
1 answer
54 views

if else statement returning wrong answer [duplicate]

import java.util.Scanner; public class orOperator { public static void main(String args[]) { System.out.println(" This code is to check you are eligible or not"); Scanner ...
buddhasatta's user avatar
0 votes
0 answers
52 views

case_when(): How to add a warning message if all conditions are met in the first statement

Consider this example data frame: df <- structure(list(id = 1:3, Day = c(0L, 0L, 0L), baseline = structure(c(0.78, 0.92, 1.09), names = c("", "", "")), day_1_2_value =...
TarJae's user avatar
  • 73.8k
0 votes
0 answers
28 views

How to hide a table and header rows using conditional statements in Javascript

I am working on a custom-picking ticket (advanced PDF) in Netsuite. One of the elements on the ticket is a table that shows any backordered items that were purchased. But if all of the ordered items ...
wp1928's user avatar
  • 1
0 votes
1 answer
38 views

Add condition to for loop dataframe dictionary import

I currently have a dictionary consisting of 11 imported dataframes of various sizes. I want to add a condition so that i only import the dataframes that hold a certain number of observations, say 50k. ...
Navi Mateo's user avatar
1 vote
1 answer
40 views

Select employees with no managers - two solutions

I found the below test task on some testing platforms. We have a table definition: CREATE TABLE employees ( id integer NOT NULL, name character varying(20), "managerId" integer, ...
Csaba Benko's user avatar
  • 1,141
0 votes
2 answers
43 views

How to Highlight Second Highest Values in Google Sheets Using Conditional Formatting?

In Google Sheets, I would like to highlight the 2nd highest value in a column of a table. I am making a table in Google Sheets and want to highlight all 2nd highest values using conditional formatting....
Dhiraz Singh's user avatar
0 votes
0 answers
12 views

I am trying to sum a range based on a conditional formatting - bold in this case

I have VBA code that works if the cell is actually bold but it does not work if bold via conditional formatting. This code sums if the cell is actually bold: Function SumIfNotBold(MyRange As Range) As ...
Barry Hill's user avatar
1 vote
1 answer
57 views

Create multiple columns with same prefix based on conditions from multiple columns

I have data that look like this, with the dates of Birth and Death for patients. ID DOB Birth_Year DOD Death_Year 1 2016-10-01 2016 2019-10-15 2019 2 2017-07-01 ...
Yanting Luo's user avatar
0 votes
1 answer
24 views

Comparing the value with a value before it in the pandas dataframe

I have a DataFrame df: open high low close 187100 187100 187100 187100 188000 188000 188000 188000 188000 188000 188000 188000 188000 188000 188000 188000 188000 188000 188000 ...
Hannah's user avatar
  • 1
0 votes
2 answers
80 views

How to use Makefile conditionals with bash commands as a preparation step for Makefile rules?

For some practical reasons, it would be useful for me to prepare the place for the Makefile rules in the working directory. Consider the hypothetical case that, if the $(VAR) value is true, I need to ...
Roland Tóbiás's user avatar
1 vote
1 answer
42 views

How to identify remove duplicates based on all columns except for one?

I have data like the following data frame, want to find the duplicates based on all the columns except for date, use that excluded column (date) to determine which rows are to be removed (only keep ...
user22757672's user avatar
0 votes
1 answer
50 views

How can I delete those rows in R where two conditions apply?

I have two variables "CSO" (1 or 0) and "DateStartRole" (specific date or NA). Now I want to delete those rows within my tibble "refinitiv_boardex" if the variable "...
FaFe's user avatar
  • 1
0 votes
3 answers
131 views

How can I make a grid using " | " and " _ " on java?

I'm a beginner at Java, and my programming teacher gave us an assignment that we need to make a grid of little squares using "|" and "_". Assignment I know this might look stupid, ...
Daniel Mases's user avatar
1 vote
1 answer
43 views

Excel: How to color cells based on condition A = C and the sum of values in B is less than D?

Column A, starting from A1, contains the following values: sasa masa sasa masa sasa sasa sasa vasa vasa Column B, starting from B1, contains the following values: 2 3 4 5 6 4 1 1 2 Column C, starting ...
Sasa VESELINOVIĆ's user avatar
0 votes
2 answers
59 views

Python Data frame: I want to add a new column based on the result of another column

I have a "Date" column & "Time" column. I want to create a new column "Tradedate" & depending on the following condition: If "Time" = 23:00:00, then add ...
cathal's user avatar
  • 13
0 votes
0 answers
26 views

Using SSIS and the KingswaySoft with OR filter condition getting timeout

Using SSIS and the KingswaySoft with OR filter condition getting timeout as in the below shown error message. SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Dynamics CRM Source ...
user166626's user avatar
0 votes
1 answer
53 views

Create new columns based on multiple conditions [duplicate]

I have a dataframe with 3 columns. My goal is to create 2 new columns based on the conditions as listed below. id a b c new col1 new col2 1 99 0.1 5 2 35 ...
Passive_coder's user avatar
0 votes
2 answers
47 views

How to use .assign with with .where() for "condition, true, false" like in numpy.where()?

I have a dataframe df: # %% import pandas as pd # %% values = [("a", 1), ("b", 2), ("c", 3), ("d", 4), ("a", 4), ("b", 6), ("c", 7)...
Vega's user avatar
  • 2,699
3 votes
3 answers
123 views

C# if condition format

I have a condition like this. if (data.Data != null && data.Data.Any()) I wanna change like this. if (data is not { Data: null } && data is { Data: ... }) How can we check if there are ...
Saruhan's user avatar
  • 91
0 votes
0 answers
43 views

instruction pointer in near jump 8086

how the result of IP=5 is reached ? shouldn't we add IP(new)=IP(current)+disp = 002+ 002=04 or does the new IP is calculated after the jump instructions end (start of next ) IP(new)=IP(next ...
Hussien Mostafa's user avatar
0 votes
0 answers
24 views

Image is cutoff with Shiny/Flexdashboard

I need to conditionally display a series of instructions and a corresponding image. I was unable to get both to display using renderUI (I believe this is due to a bug in flexdashboard). I solved this ...
missgwolf's user avatar
  • 356
1 vote
3 answers
78 views

Get content from json with Php conditionally

I am struggling to get some informations/values from a json using php conditionally. To be more detailed, this is my case: I have a json response that looks like this: { "IsSuccess": true, &...
Kleidi's user avatar
  • 43

1
2 3 4 5
384