Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [conditional-statements]

The tag has no usage guidance.

1
vote
0answers
5 views

Hide, Show and Replacing PDF form content blocks with multiple fillable fields

I am trying to build a single fillable PDF form that provides hiding/showing/replacing of context-specific signature blocks containing multiple fields, after selecting a radio button. Ideally, when a ...
-1
votes
2answers
31 views

Excel over 100% then = 100%

I am calculating percentage and currently I have cells with the formula =IF($H4="3PL",L4/Data!B$24,L4/Data!B$21) I need to add a second piece: If the answer of above is greater than 100% make it ...
0
votes
1answer
9 views

Optimize code to check a Data Validation cell to pick another cell

I have cell E2 that contains a Data Validation group: "online", "article", "journal", "proceedings" and "magazine". I am populating cell K2 with a formula that is based on E2's entry. If I select an ...
-1
votes
1answer
24 views

Nested IF and AND Statement for a range

Here's what I'm trying to accomplish: I have a cell, U5 which has a value between 2-18 ... If U5 < 6, assign a 1 If U5 is >5 but <9, assign a 3 If V5 is >8 but <15, assign a 6 If V5 is >14, ...
1
vote
1answer
28 views

TCL/Expect script with if/else logic based on host IP address

So I have been using and enjoying /usr/bin/expect for scripts because it can quickly log me into servers since it autocompletes my userid and password. Through some cursory reading, I've come to ...
0
votes
0answers
12 views

fish shell - run command based on exit status of previous command

My goal is to have a monitor setup, that is as flexible and easy to use as possible. I use fish as my shell and have added the following two lines: abbr mon 'xrandr --output DP2 --auto --primary --...
1
vote
2answers
70 views

How does bash test 'false'?

$ false $ echo $? 1 $ if [[ false ]]; then echo 'do it'; fi do it $ test false && echo 'do it' do it $ COND=false $ echo $COND false $ if [[ $COND -ne 0 ]]; then echo 'do it'; fi $ if [[ $...
1
vote
0answers
18 views

Preserve Styles in Microsoft Word 2016 Conditional Text

I have an MS Word document from which I need to create 2 subdocs for internal/public audiences. I am using the IF field to condionalize the master doc. In one section, the "truetext" contains a few ...
0
votes
1answer
17 views

Is there a better way to accomplish this? Excel copy-pasting using conditional statement based on formatting conditions of the cells above and below

How can I achieve the after where the dates are copied next to the appropriate expenses without having to manually copy paste? I guess the logic is that all the charges copy the date before them which ...
0
votes
1answer
26 views

Run command only on certain files in subfolders, depending on other files

I've got a folder called Music, that has subfolders of different artist, containing a whole lot of .flac files. I'm trying to convert all of them into the .wav file format and then convert them to ...
-2
votes
1answer
36 views

I'm trying to return the results of one of the if statements, but I am only able to get True/False results? [closed]

=IF(OR(AND(C11=1,(B13+3+(VLOOKUP(C15,'Locks and Readers per day'!A:B,2,FALSE)))), AND(C11=2,(B13+3+(VLOOKUP(C15,'Locks and Readers per day'!A:C,3,FALSE)))),(C11=3,(B13+3+(VLOOKUP(C15,'Locks and ...
1
vote
2answers
81 views

Can I implement IF EXIST with a given file extension?

I'm in the process of making a batch script to autoexecute a program if a given file type (in this case specifically *.iso) is found. Here is the current direction I'm headed: IF EXIST *.iso GOTO :...
1
vote
0answers
80 views

Ignoring /substituting missing certificate files in apache 2.4 config

Are there any directives or constructs I can use in Apache 2.4 to prevent Apache from failing to load at all if a certificate file is missing for an https Virtualhost is missing. (I am dealing with a ...
0
votes
0answers
60 views

Simulink conditional breakpoint, find location of the one that triggered

I put conditional breakpoints in my Simulink model but they are in different subsystems. Sometimes my simulation pauses, and I guess it is because a conditional breakpoint triggered. Is there an ...
0
votes
2answers
237 views

Excel - Don't make a blank cell if condition returns false

I have this formula =IF(Sheet1!C2="x", Sheet1!B2,"") which function is to match if the cell from Sheet1 in column C is same as the character of x, if true then get the value of Sheet1 in column B and ...
0
votes
0answers
33 views

Creating tables in a Word document conditionally on checkbox clicks

I'm trying to create a document where the user can click one or more checkboxes to make tables associated with each appear in the document, ready to be filled in. I've been looking into the ...
0
votes
1answer
216 views

how to use Jenkins conditionals?

I have a flow inside a simple project, I want to do the following if the day is Saturday I want to run job A else I would like job B to run, schematically like this: DAY = $(date+"%A") if($DAY == ...
2
votes
1answer
537 views

Sending specific email based on cell values in Excel 2016?

Is there a more efficient way to send email reminders to a user based on a cell value that changes frequently? Here's the code of what I'm working on so that you guys could understand the context of ...
1
vote
1answer
49 views

Excel: Identify Cells with Duplicate Value in One Cell, and Equals 0 in the Next Cell

I am trying to remove inactive print queues from a print server. Each printer has a separate queue for each tray. The catch is that I only want to remove queues which have no activity on any of its ...
1
vote
1answer
40 views

Excel 2016: to find the first occurance of a value in a vector

I have a vertical vector (see below) and I am looking for a function where I can search for the first occurance of the "1" or a "2" or a "3". If I find the first "1" I would add a value to a cell and ...
1
vote
1answer
55 views

Excel 2016 conditional statement in combination with an OR?

Is it possible to combine a conditional statement w/ BOOLEAN OR, like: =IF(x=1 OR 2) do x o/w do y ?
0
votes
1answer
114 views

EXCEL 2016 VLOOKUp or conditional statement?

The aim is to compare a halogen light bulb with a LED bulb to find out which technology is cheapest in the long run. I want to check when a Halogen bulb burns out during the year. The "lifetime" is ...
0
votes
2answers
2k views

Excel - If two cells are greater than 0, than return the cell that is greater, if only one cell is greater than 0, than return that value

I have been trying to figure this out for a while now but I'm stuck on the [value_if_false] part and I feel like it's really simple but it's not coming to me. So basically, trying to display the ...
1
vote
1answer
131 views

Vba Excel : using OR column condition without duplicating row

This is an updated version for this. The above solution is good, until I realized when I put in massive data, the for loop generates duplicate rows (which unwanted results) I found some method ...
0
votes
0answers
159 views

Why is bash using -ge to compare instead of ==?

So I'm looking at adding a low hard drive space warning to my home server. I like the look of the following which comes from here: ADMIN="yourmail@example.com" # set alert-level 90 % standard ALERT=...
1
vote
1answer
604 views

How to use if statement in batch file?

I have the following for loop in my batch file: for /f %%y in ('findstr /C:"%%c" out.txt ^| sed "s/.*%%c \([^>]*\).*/\1/i"') do SET RESULT=%%y echo.%%a;%%b;%%c;!RESULT!>>D:\outputTA.txt My ...
-1
votes
2answers
105 views

How do I set up a conditional formula with multiple criteria?

I recently needed to find matches occurring anywhere within a column. This article here How to identify cells in Column A that contain any of the values in Column B gave me exactly what I needed to ...
0
votes
0answers
55 views

How do I externally reference rows from one sheet to another based on a non-numerical condition in one column no the original sheet?

I currently have a large list of product information on a sheet in an Excel workbook. I want to copy and paste certain rows of data - the whole row - to a new sheet based on a certain column (all the "...
1
vote
4answers
37 views

Load condition within execution line in Bash

I want to execute a command with an option that depends on the attribution of a variable. If the variable is set, load the option with the value, but if not, don't load that option. This is what I ...
1
vote
2answers
232 views

Conditionally add images to bubble chart? [closed]

I need to mass produce bubble charts for a large set of peer groups, where each chart shows anonymized peer group data but highlights the group of interest with their team logo. I'd like to automate ...
0
votes
1answer
580 views

how diff command behaves on if statement in shell script

I have tried following code.. if diff f1.sh f2.sh; then echo Same else echo Different fi Here.. In my case both f1.sh and f2.sh are different files.. So if statement prints Different(as ...
0
votes
1answer
106 views

Is is possible to set the “expires” time based on “creation” time?

After using Keepass for several years, an idea came to me that would be nice to implement. There are over 300 records in my database, and it would be nice to know which of those records are still good....
0
votes
1answer
10k views

If Function is not working in Excel

I had made a sheet to calculate factory workers timing and payment against working and over time. First I made it in Excel 2013 and then I changed my Windows from 10 to 7 and also changed the ...
1
vote
1answer
42 views

Delete every row that doesn't contain a blank

I need to delete every row in Excel that does not contain a "blank" value in one of its six columns. I tried sorting each column, but there's 100k+ rows and that method really only works if I'm ...
2
votes
1answer
113 views

Bash Regex oddity when using =~ operator

Consider this code: s1="1,2,3,4"; \ s2="1,2,3"; \ sP='^(([1-9][0-9]{0,},){1,2}){1,2}$'; \ [[ "${s1}," =~ $sP ]] && echo "\$s1 matches"; \ [[ "${s2}," =~ $sP ]] && echo "\$s2 matches,...
0
votes
2answers
3k views

Need help to hide/show excel rows based on value in a cell, but allow for moving rows around later

In Row 4 I ask a question and D4 will contain the answer of either Yes or No. If the answer is Yes in D4, I want hidden rows 5 and 5 to appear with follow-up questions. This is working for me: If ...
1
vote
2answers
27k views

Multiple IF statements and concatenation in Excel

So far I've managed to concatenate cells I1 and J1 with the words "From" and "To" and put them on separate lines using: =CONCATENATE("From: ",I1," ","To: ",J1) I've also managed to populate column L ...
2
votes
4answers
8k views

Using a wildcard in a condition to match the beginning of a string

Trying to have a variable meet a string of text that varies by length. The part of the string that matters is the first couple of characters. var1=hello if [ $var1 == hello ]; then echo ...
1
vote
1answer
311 views

Excel rearrange column using copy + paste

I am trying to create a method to automatically rearrange the column when performing copy + paste. Say I have an excel file with table containing columns on the first row: ID | NAME | DATE | ...
2
votes
2answers
227 views

Vector Compare to Scalar

Is it possible to compare a vector of values to a single scalar value in Excel? Example: =IF(A1:Z1 > 0, 1, 0) Typically, I've seen the following: =IF( AND( A1>0, B1>0, C1>0, . . . Y1&...
1
vote
0answers
567 views

Mail Merge Multiple IF Conditions for cell

I have a conditional statement for two cases (and default) which works fine. This is simply to enter a cell value based on another cell value in an earlier column simplified and shorm of extraneous ...
0
votes
1answer
45 views

Excel nested IFs

I'm trying to combine several IF formulas with an IF(AND formula but struggling. I can manage Nested Ifs or an IF(AND formula but can't seem to combine them. I want to say if L2 equals 1,3 or 4 then ...
1
vote
1answer
1k views

windows 7 search: multiple condition “find folders of this size that does not contain this and that”

Windows 7 search allows to find specific files type and exclude some using some operators (such as AND OR NOT) but how to add multiple search condition on these following example? Ex 1: this query ...
0
votes
2answers
3k views

Word 2010 Mail Merge Suppress Blank Conditional Mergefields

I cannot get a conditional Mail Merge to suppress blank lines in a relatively clean and efficient way. The only solution I have found is one I am not willing to use yet as I feel there may be a better ...
1
vote
3answers
1k views

Automatic text entry dependent on text in other cells [closed]

I have two columns of text and want to automatically enter text into the third column depending on the text in the previous two columns. It's a risk matrix; for instance if A1 says 'Likely' and B1 ...
0
votes
1answer
808 views

AHK if/else of output from Custom Message Box Function

I've been trying to create a script that displays message boxes conditioned on the output from another customized message box with more than 3 options. The custom functions are taken form this thread ...
1
vote
1answer
685 views

If statement that returns original function if false (similar to iferror, or substitute)

If I use IFERROR as opposed to IF(ISERROR I can save typing the condition twice. i.e. =IFERROR(Long lookup,"not found") is much preferable to =IF(ISERROR(long_lookup),"not found",long_lookup) ...
0
votes
1answer
103 views

Excel cell value (text) based on 2nd cell value (number) appearing in a named range

I have a spreadsheet where I want a contact name to appear in a cell F166 if the department number P166 appears in a named range (PS Depts on Sheet2). Here is my existing formula, but it only allows ...
2
votes
1answer
55 views

IF and then condtional format

In Column C, I Want to rename the Column A Name in order of Date Of Birth, but only if a duplicate is found. Otherwise, the name in Column C should be the same as Column A. For example, there are ...
0
votes
1answer
652 views

AVERAGEIF based on formatting

I am using Microsoft Excel 2010. I would like to do an AVERAGEIF, with the criteria based on formatting. Ex: For cells, I choose A1-A3. A1 is the percentage value 10%. A2 is the number value 20. ...