62,193 questions
0
votes
3
answers
23
views
Split function with if statement to define string value (excel vba)
My vba excel code is using split funtion from a combo box value. It takes an ID (alias=GG) which is a value right of the 6th hyphen.
GG = Split(Sheet1.ComboBox1.Value, "-")(6)
example return ...
-4
votes
2
answers
123
views
How to Fix a script by checking all input characters against all list elements, not just the first, using conditions? [closed]
prohibitedCharacters = ["@", "$"]
printed = False
name = input ("Enter username: ")
for item in prohibitedCharacters:
if item in name and not printed:
...
0
votes
1
answer
86
views
User Friendly Duplicate value message [duplicate]
I want to check to see if value from a form exists in Microsoft Access table using vba or macro that is user friendly but need help putting it together.
I've tried, Private Sub Donor_Key_LostFocus() I ...
0
votes
0
answers
61
views
Why does this count_divisors() function return 0 instead of the divisor count? [duplicate]
I'm trying to solve Project Euler Problem 12 in C++, which is to find the first triangular number with over 500 divisors.
I am currently trying to write a function that counts the number of divisors ...
3
votes
2
answers
259
views
Why does "\0" give integer in c
So, I am learning C language and was trying to make a function that returns the length of a string. In the if statement I mistakenly used "" instead of ''. So, instead of comparing to char '\...
0
votes
2
answers
126
views
How do I assign a value according to conditional statement that use dates from multiple columns [closed]
I am using a large dataset which contains patients with 5 different cancer types. Each patient can have one or more cancer diagnosis, identified in the n.cancers column. There are also columns for ...
1
vote
2
answers
180
views
How do I filter my data with a looped "if" statement while retaining data from both current, past and an average of current + past loops?
I'm currently trying to filter a dataset containing audio data on bird species. The data looks like this:
head(audiomoth_sample)
id
park
park_abbr
am_no
sci_name
com_name
start_s
end_s
conf
date_time
...
1
vote
3
answers
122
views
Excel Range IF fails with an AND
Trying to aggregate a list of names that are overdue. This works great until I add an AND to the IF, then everything falls apart and no results are returned.
I need to aggregate a list of names by ...
3
votes
3
answers
162
views
Reduce nested IF…ELSE conditions that iteratively condition building a query by adding filters one by one
My stored procedure has this structure:
if Count 1>0 then
count 2 with (condition 1,)
if Count 2>0 then
count 3 with (condition 1,2)
if Count 3>0 then
count 4 with(condition ...
3
votes
1
answer
65
views
Assign column status retrospectively in pandas
I have created the following pandas dataframe:
import pandas as pd
import numpy as np
ds = {'col1' : [234,321,284,286,287,300,301,303,305,299,288,300,299,287,286,280,279,270,269,301]}
df = pd....
-4
votes
4
answers
334
views
How to find the longer of two strings without if, switch or ternary?
How to implement a method that receives two strings and displays a message with the longer string and its length, without using if, switch or ternary operators?
4
votes
3
answers
117
views
How do I write an if statement in Excel within a specific time frame
I am looking to show hospital procedure times done out of hours which would be between 19:00pm to 07:59am.
For example a procedure start time at 01:15 should show as "Out of Hours" or "...
2
votes
2
answers
83
views
Elseif function not returning correct answer [closed]
I'm writing code in VBA that will format files.
There are different subs for each file type that should be activated by double-clicking a cell in a worksheet.
The thing is that I'm using elseif ...
0
votes
1
answer
119
views
Is it possible to restrict variable declaration of a type inside an if expression?
Snippet:
struct Foo {
constexpr explicit operator bool() const noexcept { return false; }
};
int main() {
if(auto a = Foo{}) // declaration OK
{
}
auto b = Foo{}; // ...
3
votes
1
answer
85
views
Python While loop is executed, but then it fails to execute an if statement after it
I am working on a simple 2 player dice rolling game and have found a problem that i haven't been able to fix, after a While loop, it refuses to execute an if statement
def Main():
global player1_score,...