help with IF Formula

%3CLINGO-SUB%20id%3D%22lingo-sub-1857634%22%20slang%3D%22en-US%22%3Ehelp%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1857634%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20very%20new%20to%20excel%20so%20please%20bare%20with%20me%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20trying%20to%20create%20an%20IF%20formula%20to%20do%20the%20following%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eif%20%22x%22%20appears%20in%20%22selection%22%20fill%20in%20the%20date%20from%20column%20%22a%22%20%22b%22%20%22c%22%20into%20cell%20%221%22%20%222%22%20%223%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBasically%2C%20I%20need%20a%20certain%20number%20found%20in%20a%20big%20selection.%20once%20it%20is%20found%2C%20I%20need%20the%20total%20data%20from%20certain%20columns%20to%20fill%20in%20corresponding%20cells%20above%20the%20original%20selection%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eidea's%20on%20how%20to%20write%20the%20formula%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1857634%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1857715%22%20slang%3D%22en-US%22%3ERe%3A%20help%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1857715%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F858968%22%20target%3D%22_blank%22%3E%40lorie3345%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUnfortunately%2C%20your%20description%20is%20not%20completely%20clear%20to%20me.%20In%20general%2C%20your%20formula%20would%20look%20something%20like%20this%3A%3C%2FP%3E%3CPRE%3E%3DIF(A1%3D%22X%22%2C%20%22Date%20from%20cell%22%2C%20%22Not%20X%22)%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1858734%22%20slang%3D%22en-US%22%3ERe%3A%20help%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1858734%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F858968%22%20target%3D%22_blank%22%3E%40lorie3345%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBetter%20if%20you%20provide%20small%20sample%20file%20to%20illustrate%20the%20question%2C%20perhaps%20it%20could%20be%20done%20without%20IF().%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1860675%22%20slang%3D%22en-US%22%3ERe%3A%20help%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1860675%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3BI%20attached%20a%20sample%3C%2FP%3E%3CP%3Ewhat%20needs%20to%20happen%20is%3A%3C%2FP%3E%3CP%3Efirst%2C%20the%20formula%20needs%20to%20find%20one%20of%20the%20specific%20card%20numbers%20(lets%20go%20with%20123%20for%20now)%20from%20the%20below%20selection.%26nbsp%3B%3C%2FP%3E%3CP%3Ethen%2C%20D4%20needs%20to%20display%20the%20total%20value%20located%20in%20column%20Z%20(formula%20needs%20to%20add%20all%20GST%20values%20for%20each%20row%20which%20has%20card%20number%20123)%3C%2FP%3E%3CP%3EE4%20displays%20the%20total%20column%20AA%2C%20F4%20displays%20the%20total%20from%20column%20AB%20and%20finally%2C%20G4%20displays%20the%20total%20litres%20from%20column%20Q%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBasically%2C%20I%20need%20it%20to%20search%20out%20specific%20cards%20number%2C%20add%20all%20rows%20which%20contain%20that%20card%20number%20and%20fill%20in%20the%20specific%20cells%20with%20the%20specific%20information%20I%20need%20for%20my%20report.%20This%20report%20will%20be%20calculated%20on%20a%20monthly%20basis%3C%2FP%3E%3CP%3EI%20will%20need%20to%20repeat%20the%20formula%20for%20each%20card%20number%20but%20the%20rest%20will%20be%20staying%20the%20same.%3C%2FP%3E%3CP%3EThe%20information%20will%20then%20be%20auto-populating%20a%20master%20summary%20worksheet%20to%20get%20year%20to%20date%20totals%20based%20on%20the%20sum%20of%20the%20other%20monthly%20worksheets%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20this%20make%20sense%20or%20is%20this%20impossible%20to%20do%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1860677%22%20slang%3D%22en-US%22%3ERe%3A%20help%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1860677%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F360420%22%20target%3D%22_blank%22%3E%40PReagan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20attached%20a%20sample%3C%2FP%3E%3CP%3Ewhat%20needs%20to%20happen%20is%3A%3C%2FP%3E%3CP%3Efirst%2C%20the%20formula%20needs%20to%20find%20one%20of%20the%20specific%20card%20numbers%20(lets%20go%20with%20123%20for%20now)%20from%20the%20below%20selection.%26nbsp%3B%3C%2FP%3E%3CP%3Ethen%2C%20D4%20needs%20to%20display%20the%20total%20value%20located%20in%20column%20Z%20(formula%20needs%20to%20add%20all%20GST%20values%20for%20each%20row%20which%20has%20card%20number%20123)%3C%2FP%3E%3CP%3EE4%20displays%20the%20total%20column%20AA%2C%20F4%20displays%20the%20total%20from%20column%20AB%20and%20finally%2C%20G4%20displays%20the%20total%20litres%20from%20column%20Q%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBasically%2C%20I%20need%20it%20to%20search%20out%20specific%20cards%20number%2C%20add%20all%20rows%20which%20contain%20that%20card%20number%20and%20fill%20in%20the%20specific%20cells%20with%20the%20specific%20information%20I%20need%20for%20my%20report.%20This%20report%20will%20be%20calculated%20on%20a%20monthly%20basis%3C%2FP%3E%3CP%3EI%20will%20need%20to%20repeat%20the%20formula%20for%20each%20card%20number%20but%20the%20rest%20will%20be%20staying%20the%20same.%3C%2FP%3E%3CP%3EThe%20information%20will%20then%20be%20auto-populating%20a%20master%20summary%20worksheet%20to%20get%20year%20to%20date%20totals%20based%20on%20the%20sum%20of%20the%20other%20monthly%20worksheets%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20this%20make%20sense%20or%20is%20this%20impossible%20to%20do%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1871774%22%20slang%3D%22en-US%22%3ERe%3A%20help%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1871774%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F858968%22%20target%3D%22_blank%22%3E%40lorie3345%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20review%20the%20formulas%20in%20the%20range%20D4%3AG6%20of%20the%20%22Jan%22%20tab%20in%20the%20attached%20workbook.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1873400%22%20slang%3D%22en-US%22%3ERe%3A%20help%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1873400%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F360420%22%20target%3D%22_blank%22%3E%40PReagan%3C%2FA%3E%26nbsp%3Bthat%20is%20perfect%2C%20thank%20you%20so%20much!%3C%2FP%3E%3CP%3ECould%20I%20ask%20also%20how%20you%20converted%20the%20raw%20data%20to%20a%20table%20to%20be%20used%20in%20the%20formula%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1873492%22%20slang%3D%22en-US%22%3ERe%3A%20help%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1873492%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F858968%22%20target%3D%22_blank%22%3E%40lorie3345%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20pleasure!%3CBR%20%2F%3E%3CBR%20%2F%3ETo%20convert%20data%20into%20a%20table%3A%3C%2FP%3E%3COL%3E%3CLI%3ESelect%20a%20cell%20in%20the%20range%3C%2FLI%3E%3CLI%3EHome%20tab%2C%20Styles%20Section%2C%20%22Format%20as%20Table%22%2C%20verify%20your%20table%20range%20and%20check%20if%20your%20table%20has%20headers.%3C%2FLI%3E%3CLI%3EIn%20any%20formula%2C%20you%20may%20refer%20to%20the%20table%20using%20Table1%5BHeader%5D%20where%20%22Table1%22%20is%20the%20name%20of%20your%20table%20and%20%22Header%22%20is%20the%20name%20of%20your%20header.%3C%2FLI%3E%3C%2FOL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1873520%22%20slang%3D%22en-US%22%3ERe%3A%20help%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1873520%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F360420%22%20target%3D%22_blank%22%3E%40PReagan%3C%2FA%3E%26nbsp%3Bthank%20you%20so%20much%2C%20you%20have%20helped%20me%20tremendously!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1873523%22%20slang%3D%22en-US%22%3ERe%3A%20help%20with%20IF%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1873523%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F858968%22%20target%3D%22_blank%22%3E%40lorie3345%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou're%20welcome.%20Happy%20to%20help!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I am very new to excel so please bare with me

 

I'm trying to create an IF formula to do the following:

 

if "x" appears in "selection" fill in the date from column "a" "b" "c" into cell "1" "2" "3"

 

Basically, I need a certain number found in a big selection. once it is found, I need the total data from certain columns to fill in corresponding cells above the original selection

 

idea's on how to write the formula?

20 Replies

Hello @lorie3345,

 

Unfortunately, your description is not completely clear to me. In general, your formula would look something like this:

=IF(A1="X", "Date from cell", "Not X")

 

@lorie3345 

Better if you provide small sample file to illustrate the question, perhaps it could be done without IF().

@Sergei Baklan I attached a sample

what needs to happen is:

first, the formula needs to find one of the specific card numbers (lets go with 123 for now) from the below selection. 

then, D4 needs to display the total value located in column Z (formula needs to add all GST values for each row which has card number 123)

E4 displays the total column AA, F4 displays the total from column AB and finally, G4 displays the total litres from column Q

 

Basically, I need it to search out specific cards number, add all rows which contain that card number and fill in the specific cells with the specific information I need for my report. This report will be calculated on a monthly basis

I will need to repeat the formula for each card number but the rest will be staying the same.

The information will then be auto-populating a master summary worksheet to get year to date totals based on the sum of the other monthly worksheets

 

Does this make sense or is this impossible to do?

 

@PReagan 

I attached a sample

what needs to happen is:

first, the formula needs to find one of the specific card numbers (lets go with 123 for now) from the below selection. 

then, D4 needs to display the total value located in column Z (formula needs to add all GST values for each row which has card number 123)

E4 displays the total column AA, F4 displays the total from column AB and finally, G4 displays the total litres from column Q

 

Basically, I need it to search out specific cards number, add all rows which contain that card number and fill in the specific cells with the specific information I need for my report. This report will be calculated on a monthly basis

I will need to repeat the formula for each card number but the rest will be staying the same.

The information will then be auto-populating a master summary worksheet to get year to date totals based on the sum of the other monthly worksheets

 

Does this make sense or is this impossible to do?

 

@lorie3345

 

Please review the formulas in the range D4:G6 of the "Jan" tab in the attached workbook.

@PReagan that is perfect, thank you so much!

Could I ask also how you converted the raw data to a table to be used in the formula?

@lorie3345 

 

My pleasure!

To convert data into a table:

  1. Select a cell in the range
  2. Home tab, Styles Section, "Format as Table", verify your table range and check if your table has headers.
  3. In any formula, you may refer to the table using Table1[Header] where "Table1" is the name of your table and "Header" is the name of your header.

@PReagan thank you so much, you have helped me tremendously!

@lorie3345 

 

You're welcome. Happy to help!

@PReagan could I ask you one more thing? I entered in the formula in on my live document but for some reason more lines are adding than the lines associated with the specific card number. I have verified it several times and the card number match so I'm a bit confused on why it is not working

any idea's ?

Ex: card number 123 is listed on rows 7-10 but the formula is adding rows 7-25 instead of stopping at row 10 (row 11 a new card number starts)

 

@lorie3345 

Unfortunately, I am not sure where your error is occurring. It sounds like you have changed the format of the worksheet. In the sheet that you initially shared, the data was contained in rows 12 through 25, there was no data in rows 7 through 10. Perhaps this is where your issue is occurring?

@PReagan I think it may be because my original data "dump" came from a CSV file so I think the card numbers (which are listed as ="123" in the cell) are confusing the formula

I'm just trying to figure out how to convert the CSV data to number text without repasting all the information from the original CSV data file again.... do you think that may be the issue as well?

@lorie3345 

 

I'm not quite sure what you mean by converting to "number text". If the data is coming in as exactly "123" (with quotes) and not exactly 123, then you may use Ctrl+H to find and replace every instance of a quote (") with nothing. The value under Card number column should match exactly the value under the CARD column.

@PReagan with the CSV file the data comes in with an equals sign in front of the card number and the card number has quotes around it (I'm guessing it comes right from some accounting software) if I try to format the cells to anything (text, general whatever) the data in cell turns into a weird combination of numbers and special characters. 

when I try to convert my card numbers to match exactly what is written in the table (card column) I get an error likely due to the data being generated from a different software program (but I'm not sure lol)

So, I was thinking a could try and change the format of the CSV data, then the card numbers would match the card numbers in the table

I can attach my real spreadsheet file (not the sample from before) for you to see what I'm trying to do if that's easier? 

 

@lorie3345 

 

Yes, attaching your spreadsheet would be helpful (Please remove any sensitive data).

@PReagan here it is

You'll see on the Jan 2020 worksheet the first to card numbers are calculating data from rows 76-119 but I believe it's because of the format of the card numbers in the table

The rest of the card numbers listed on the top --> I have manually calculated the totals in the GST, NET

Total etc... categories (I have been using those totals to verify what totals the formula was calculating)

I am in the processing of adding the full card numbers but, again, the formatting seems to be an issue

 

@lorie3345 

 

Please review the attached workbook.

@PReagan you are amazing! thank you so much, this is perfect

@lorie3345 

 

My pleasure!