Formula based on cell value

Mac88

New Member
Joined
Feb 14, 2017
Messages
2
First of all greetings to everyone. This is my first post, but i am following this forum for a long time and i found a lot of answers here :)

But now i have a specific question where i didn't find an answer here, so please help if you know how to make it work.

I have a large table with a lot of values where i have to compare the values from each month. I have written all the formulas that i need and everything i working ok.. Now i have all the formula fixed based on column number(column A,b,c,d...), but the problem is that the months won't be always in the same columns.

So i would need a formula like this: Where the call value matches "Mar" execute some sample formula, where the call value matches "Jun" execute another formula and so on....

JanFebMarAprMajJunJulAvgSepOktNovDec
test12-345678-5101112
test1123456789101112
test21234-56789101112
test3123456789101112
test4123456789101112
test5123456789101112
test6123456789101112
test7123456789101112
test8123456789101112
test9123456789101112
test10123456789101112
test11123456-789101112
test12123456789101112
test13123456789101112

<tbody>
</tbody>

Hope i wrote it clearly enough...

Thanks for any help.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
To be honest I don't know what your formulas look like but why don't you use combination of MATCH, ADDRESS, INDIRECT and ROW functions? Something like this:

Excel 2007
ABCD
1FebJanResult
2test123444444
3test1342555555

<tbody>
</tbody>
Arkusz1

Worksheet Formulas
CellFormula
D2=INDIRECT(ADDRESS(ROW(),MATCH("Jan",$1:$1,0),1,,"sheet1"))
D3=INDIRECT(ADDRESS(ROW(),MATCH("Jan",$1:$1,0),1,,"sheet1"))

<tbody>
</tbody>

<tbody>
</tbody>



Function MATCH provides column number where January resides to ADDRESS formula. ROW returns row number also for ADDRESS.
ADDRESS formula returns cell address as a text which is translated as a range by INDIRECT function. This way it returned a proper value. You can use this formula combination with other formulas which require cell address.
 
Last edited:
Upvote 0
Hi Nardagus,

I'm using just a nested IF formula. like bellow. The formula is in column I.

And now i have the formula fixed based on column (C,E,G) but the months won't be always in the same column.
So i would need that the formula would check the names of the month and check if the value is there negative, if not perform the next check.

For example: Check if the value under month Mar is negative, if yes give result Q1 if not perfom the same check for month Jun, and so on....

"=IF(C:C<0;"Q1";IF(E:E<0;"Q2";IF(G:G<0;"Q3";"")))"

ABCDEFGHI
JanFebMarAprMaiJunJulresult
12-3-5-9-10-13Q1
2521-10-12-13Q2
326145-15Q3

<tbody>
</tbody>
 
Upvote 0
Let me get this straight.

Do you want to check which month you got first negative value in a particular row? Then based on a month return which quarter it was?
Then I suggest to do a translation table for months vs quarters in another worksheet:
Excel 2007
AB
1MonthQuarter
2JanQ1
3FebQ1
4MarQ1
5AprQ2
6MayQ2
7JunQ2
8JulQ3
9AugQ3
10SepQ3
11OctQ4
12NovQ4
13DecQ4

<tbody>
</tbody>
Month vs Quarters
Then based on your example a formula would look like this:

Excel 2007
ABCDEFGHI
1JanFebMarAprMayJunJul
212-3-5-9-10-13Q1
32521-10-12-13Q2
4326145-15Q3

<tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
I2{=INDEX('Month vs Quarters'!B:B,MATCH(INDIRECT(ADDRESS(1,MATCH(1,IF(A2:G2<0,1),0),1,1)),'Month vs Quarters'!A:A,0))}
I3{=INDEX('Month vs Quarters'!B:B,MATCH(INDIRECT(ADDRESS(1,MATCH(1,IF(A3:G3<0,1),0),1,1)),'Month vs Quarters'!A:A,0))}
I4{=INDEX('Month vs Quarters'!B:B,MATCH(INDIRECT(ADDRESS(1,MATCH(1,IF(A4:G4<0,1),0),1,1)),'Month vs Quarters'!A:A,0))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

What I did was to create an array formula. So:
Lets analyze second row.
IF formula (thanks to array formula) checks every cell in a range for negative value. If yes then it returns 1 which is looked for by MATCH formula. When MATCH finds 1 then it returns actual position of a cell with negative value in the range. And since I've used a range starting from a column A it returns actual column. ADDRESS and INDIRECT allow me to get month name from a first row and a column where was negative value found (column 3). Then using second MATCH with a combination with INDEX I get info about a quarter from a second sheet.

I hope this is what you needed and my explanation is clear. :)
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,285
Members
449,094
Latest member
GoToLeep

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top